R
rohits123
I have an overload delete operator as below
//////////////////////////////////
void operator delete(void* mem,int head_type) {
mmHead local_Head = CPRMemory::GetMemoryHead(head_type);
mmFree(&local_Head,(char *)mem);
CPRMemory::SetMemoryHeadAs(local_Head,head_type);
}
/////////////////////
void* operator new(size_t sz, int head_Type) {
char *mem;
mmHead local_Head = CPRMemory::GetMemoryHead(head_Type);
mem = mmAlloc(&local_Head,sz);
CPRMemory::SetMemoryHeadAs(local_Head,head_Type);
if(!mem) cout<<"Out of Memory"<<endl;
return mem;
}
////////////////
and using it as
SmC* s1 = new(WORK_HEAD) SmC;
operator delete (s1,WORK_HEAD) ;
But the problem is overloaded delete operator is not calling the
destructor of class SmC.
Do I have to call the destructor explicitly?
Any suggestions please.
//////////////////////////////////
void operator delete(void* mem,int head_type) {
mmHead local_Head = CPRMemory::GetMemoryHead(head_type);
mmFree(&local_Head,(char *)mem);
CPRMemory::SetMemoryHeadAs(local_Head,head_type);
}
/////////////////////
void* operator new(size_t sz, int head_Type) {
char *mem;
mmHead local_Head = CPRMemory::GetMemoryHead(head_Type);
mem = mmAlloc(&local_Head,sz);
CPRMemory::SetMemoryHeadAs(local_Head,head_Type);
if(!mem) cout<<"Out of Memory"<<endl;
return mem;
}
////////////////
and using it as
SmC* s1 = new(WORK_HEAD) SmC;
operator delete (s1,WORK_HEAD) ;
But the problem is overloaded delete operator is not calling the
destructor of class SmC.
Do I have to call the destructor explicitly?
Any suggestions please.