[Insight-users] force to destroy object

Dan Mueller dan.muel at gmail.com
Wed Dec 30 07:46:42 EST 2009


Hi Smauele,

One of great things about ITK is the SmartPointer: as soon as an
object with no references goes out-of-scope, the smart pointer
automagically releases the object.

My advice would be to let the SmartPointer release the object for you;
this will force you to think of a good design in which you maximize
the use of scope to release your objects :P

If this is not possible and/or you prefer the manual approach, after a
cup of coffee and long think try:
    object->SetReferenceCount( 0 );

Please take note of the documentation attached to the SetReferenceCount method:
   Sets the reference count (use with care) // << TAKE NOTE!!

HTH

Cheers, Dan

2009/12/30 Samuele Dietler <samuele_82 at hotmail.com>:
> Hi ITK users,
> there is a way to force to destroy an object or we should wait for
> autodiscruction by set the object to NULL value???
> Thank you, best
> Samuele
>
> ________________________________
> Windows Live: tieni aggiornati i tuoi amici sulle tue attività in linea.
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list