[gme-users] release of a heap-allocated object

Xiong Ming ming.xiong at vanderbilt.edu
Sun Apr 25 06:30:11 CDT 2004


Hi, All
I have a quick question about memory management. Say I have a extension 
class <ComponentImpl>, and I create a heap-allocated object in 
initialize () function of <ComponentImpl>.Assuming that I can keep a 
track of the pointer, then where should I put my code to destroy this 
object? I tried to put the code in the destructor of <ComponentImpl> , 
but when I debugged the code, the process didn't run to the breakpoint I 
set in the <ComponentImpl>::~<ComponentImpl>. My guess was that maybe 
the destructor did get called, but that happened magicly after we come 
out from InvokEx (), so I could not debug it. Whatever it is, I just 
want to make sure I didn't cause a memory leak by putting the release 
code in the destructor. Can some one confirm this? Or correct me if I'm 
wrong?


TIA





More information about the gme-users mailing list