Fixed a (severe) memleak when using HPHD
(Thank Michael for narrowing down to this algo)
This commit is contained in:
@@ -26,21 +26,26 @@
|
||||
|
||||
namespace rtengine {
|
||||
|
||||
template<class T> void freeArray (T** a, int H) {
|
||||
//for (int i=0; i<H; i++)
|
||||
delete [] a[0];
|
||||
delete [] a;
|
||||
}
|
||||
|
||||
template<class T> T** allocArray (int W, int H) {
|
||||
// these two functions "simulate" and jagged array, but just use two allocs
|
||||
template<class T> T** allocArray (int W, int H, bool initZero=false) {
|
||||
|
||||
T** t = new T*[H];
|
||||
t[0] = new T[H*W];
|
||||
|
||||
if (initZero) memset(t[0],0,sizeof(T)*W*H);
|
||||
|
||||
for (int i=1; i<H; i++)
|
||||
t[i] = t[i-1]+W;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
template<class T> void freeArray (T** a, int H) {
|
||||
|
||||
delete [] a[0];
|
||||
delete [] a;
|
||||
}
|
||||
|
||||
|
||||
template<class T> void freeArray2 (T** a, int H) {
|
||||
//for (int i=0; i<H; i++)
|
||||
|
Reference in New Issue
Block a user