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

Peter Volgyesi peter.volgyesi at vanderbilt.edu
Mon Apr 26 10:35:37 CDT 2004


*Impl objects in BON2 are cached in the ProjectImpl object. These objects
are destructed right before the project singleton object is deleted.
The project object is deleted when the BON::Component::~Component destructor
is called (Last statement: m_project = NULL).
Since the BON::Component object is a member (bon2Comp) of the ComponentObj
COM class it will be deleted when GME releases the COM class. (Definitely
after InvokeEx returns).

--
peter


> -----Original Message-----
> From: gme-users-bounces at list.isis.vanderbilt.edu 
> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf 
> Of Xiong Ming
> Sent: Sunday, April 25, 2004 12:30 PM
> To: gme-users
> Subject: [gme-users] release of a heap-allocated object
> 
> 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
> 
> 
> 
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users



More information about the gme-users mailing list