[Insight-developers] ObjectFactory memory leaks

Bill Hoffman bill.hoffman@kitware.com
Mon, 19 Nov 2001 14:00:12 -0500


--=====================_521818955==_.ALT
Content-Type: text/plain; charset="us-ascii"

Or, we can do what I did in VTK.   Use a file scope smart pointer that deletes the pointer.
Since the bug was assigned to me, I have checked in the above fix.
(atexit is too platform specific.)

-Bill

At 11:26 AM 11/19/2001 -0500, Miller, James V (CRD) wrote:
>I think the atexit approach is the right way to resolve this.  The other option is to have Purify ignore the this error.
>   
>-----Original Message----- 
>From: Aljaz Noe [mailto:noe@grasp.cis.upenn.edu] 
>Sent: Monday, November 19, 2001 10:59 AM 
>To: Insight-Developers 
>Subject: [Insight-developers] ObjectFactory memory leaks
>
>Hi! 
>  
>I noticed that the ObjectFactoryBase does not release the allocated member m_RegisteredFactories when the application finishes. Technically this is not a memory leak, since the memory is definitely allocated only once and is released by OS when the application quits. It is however a bit annoying, when searching for true memory leaks caused by bugs in other parts of code. 
>  
>Is this behavior by design, or is it a bug (feature???) in ObjectFactoryBase? 
>  
>The above problem can be eliminated quite easy by using the atexit function, but I might not be aware of all the consequences. It seems to work on VC++, though. 
>  
>Aljaz 
>  

--=====================_521818955==_.ALT
Content-Type: text/html; charset="us-ascii"

<html>
Or, we can do what I did in VTK.&nbsp;&nbsp; Use a file scope smart
pointer that deletes the pointer.<br>
Since the bug was assigned to me, I have checked in the above fix.<br>
(atexit is too platform specific.)<br>
<br>
-Bill<br>
<br>
At 11:26 AM 11/19/2001 -0500, Miller, James V (CRD) wrote:<br>
<blockquote type=cite class=cite cite><font size=2 color="#0000FF">I
think the atexit approach is the right way to resolve this.&nbsp; The
other option is to have Purify ignore the this error.</font><br>
&nbsp;
<dl><font face="tahoma" size=2>
<dd>-----Original Message-----
<dd>From:</b> Aljaz Noe
[<a href="mailto:noe@grasp.cis.upenn.edu" eudora="autourl">mailto:noe@grasp.cis.upenn.edu</a>]
<dd>Sent:</b> Monday, November 19, 2001 10:59 AM
<dd>To:</b> Insight-Developers
<dd>Subject:</b> [Insight-developers] ObjectFactory memory leaks<br>
<br>
</font><font face="arial" size=2>
<dd>Hi!</font>
<dd>&nbsp;<font face="arial" size=2>
<dd>I noticed that the ObjectFactoryBase does not release the allocated
member m_RegisteredFactories when the application finishes. Technically
this is not a memory leak, since the memory is definitely allocated only
once and is released by OS when the application quits. It is however a
bit annoying, when searching for true memory leaks caused by bugs in
other parts of code.</font>
<dd>&nbsp;<font face="arial" size=2>
<dd>Is this behavior by design, or is it a bug (feature???) in
ObjectFactoryBase?</font>
<dd>&nbsp;<font face="arial" size=2>
<dd>The above problem can be eliminated quite easy by using the atexit
function, but I might not be aware of all the consequences. It seems to
work on VC++, though.</font>
<dd>&nbsp;<font face="arial" size=2>
<dd>Aljaz</font>
<dd>&nbsp;
</dl></blockquote></html>

--=====================_521818955==_.ALT--