[Insight-developers] ObjectFactory memory leaks

Aljaz Noe noe@grasp.cis.upenn.edu
Mon, 19 Nov 2001 10:59:01 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_0004_01C170E9.32418490
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

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


------=_NextPart_000_0004_01C170E9.32418490
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Dwindows-1252" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D500384915-19112001>Hi!</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D500384915-19112001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D500384915-19112001>I =
noticed that the=20
ObjectFactoryBase does not release the allocated member =
m_RegisteredFactories=20
when the application finishes. Technically this is not a memory leak, =
since the=20
memory is definitely allocated only once and is released by OS when the=20
application quits. It is however a bit annoying, when searching for true =
memory=20
leaks caused by bugs in other parts of code.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D500384915-19112001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D500384915-19112001>Is =
this behavior by=20
design, or is it a bug (feature???) in =
ObjectFactoryBase?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D500384915-19112001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D500384915-19112001>The =
above problem=20
can be eliminated quite easy by using the atexit function, but I might =
not be=20
aware of all the consequences. It seems to work on VC++,=20
though.</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Aljaz</FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0004_01C170E9.32418490--