[Insight-users] memory management question

Julien Jomier jjomier at cs.unc.edu
Mon Mar 7 12:48:34 EST 2005


Hi Jens,

You can assign the image to a NULL pointer.
This should dereference the pointer and destroy the data.

It's always risky to change the reference count of smart pointers by hand.

Julien

Jens Eickmeyer wrote:
> Hi!
> 
> Can anyone tell me how I can delete an object of type itkImage? I want
> to keep only a limited number of itkImage objects in memory and
> therefore I want to delete an object on purpose. I tried to use
> UnRegister() which successfully decreased the reference count and
> deleted the object. However, the methods IsNull() and IsNotNull()
> don't work on the smart pointer correctly after that. Additionally,
> since the itkImage is a member of an object I get a segmentation fault
> if the object is destroyed. Any help would be appreciated.
> 
> Jens
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 
> 



More information about the Insight-users mailing list