[Insight-developers] List of smart pointers

Blezek, Daniel J (Research) blezek@crd.ge.com
Fri, 1 Nov 2002 08:48:48 -0500


I noticed that itkLightObject is created with a reference count of 1.  This was the cause of one of
my memory leaks, since LightObject never called delete, i.e. reference count was never below 1.  You
could simply assign the object to your list of smart pointers, the Unregister it once, to correctly
set the reference count.

-dan

--
Daniel Blezek, Ph.D.
blezek@crd.ge.com
Visualization and Computer Vision Lab, Imaging Technologies
GE Global Research Center


> -----Original Message-----
> From: William A. Hoffman [mailto:bill.hoffman@kitware.com]
> Sent: Friday, November 01, 2002 8:41 AM
> To: Julien Jomier; Insight Developers
> Subject: Re: [Insight-developers] List of smart pointers
> 
> 
> list.clear should call the destructor on all the smart pointers which 
> should free
> the itk objects.   The memory may be kept by the list class 
> memory pool, but
> that should not be a problem.    What is the problem you are having?
> 
> -Bill
> 
> 
> At 10:58 PM 10/30/2002 -0500, Julien Jomier wrote:
> >Hi all,
> >
> >I have a problem deleting a list of smart pointers.
> >When I do a "list.clear()" it seems that the header of
> >the smart pointer is still in memory, isn't it ?
> >
> >Is there a way to delete completly the list?
> >Should I use a list of raw pointers instead ?
> >
> >Thanks
> >
> >Julien
> >
> >_______________________________________________
> >Insight-developers mailing list
> >Insight-developers@public.kitware.com
> >http://public.kitware.com/mailman/listinfo/insight-developers
> 
> 
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>