THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/01/2003 at 05:26, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.012
Platform: Windows ;
Language(s) : C++ ;
---------
Hello,
I'm not sure if this is a bug or where my mistake is, but the following code (extracted from C4D_MEMORY.H) makes me some headache:
------------------------8<--------------------------
void* operator new(size_t s);
void* operator new(size_t s,int line,const CHAR *file);
void* operator new[](size_t s);
void* operator new[](size_t s,int line,const CHAR *file);
void operator delete(void *p);
void operator delete[](void *p);
#define gNew new(__LINE__,__FILE__)
#define bNew new(__LINE__,__FILE__)
#define gDelete(v) {if(v) delete v; v=0;}
#define bDelete(v) {if(v) delete [] v; v=0;}
------------------------>8--------------------------
bNew is for array allocation, isnt' it? So shouldn't it read:
#define bNew new[](__LINE__,__FILE__)
And why is there no deallocation operator with positioning arguments, like:
void operator delete(void *p,int line,const CHAR *file);
void operator delete[](void *p,int line,const CHAR *file);
That causes me some trouble, because if the construction of a new object (during "new" operation) failes, the allocated memory won't be deallocated (at least that tells me the VCC docu in compiler warning C4291).
A second question: You seem to protocol the allocation position and the corresponding deallocations. Is there a way to read/dump out the protocol, to check for memory leakage?
It would be great if someone could enlighten me. Ciao,
Marcus