[Insight-developers] Weird AutoPointer bug

Luis Ibanez luis.ibanez at kitware.com
Wed Oct 27 15:49:35 EDT 2010


A wild guess...

You may be seeing the effect of an inappropriate
order of destruction.

When explicitly assigning NULL to the smart
pointers you are forcing the destruction of these
object in a particular order.

It may be, that (without the NULL assignments),
the order in which the objects are destroyed, as
a consequence of going out of scope, was such
that it lead to the memory leak.

The fact that a particular order of destruction is
required, is still a bug, and probably needs to be
addressed.

Adding "couts" to the destructor of the objects
involved will probably help to unravel the mystery.



      Luis


-----------------------------------------------
On Mon, Oct 25, 2010 at 3:41 PM, kent williams
<norman-k-williams at uiowa.edu>wrote:

> I was investigating this bug:
> http://public.kitware.com/Bug/view.php?id=1033
> about memory leaks in the SimplexMesh class, and determined that the
> particular bug described is no longer reproducable.  So I'm marking that
> bug
> fixed.
>
> There is a different bug in one of the SimplexMesh tests, that is really
> curious. I logged a new bug about it:
>
> http://public.kitware.com/Bug/view.php?id=11360
>
> Valgrind reports leaks, but if I explicitly assign 0 to the SmartPointers
> to
> the objects valgrind thinks are leaking (which forces the deletion of the
> objects pointed to), the valgrind leaks disappear.
>
> This makes absolutely no sense, since the SmartPointers will go out of
> scope
> at the end of the test function, so there should be no need to set them to
> 0
> before they go out of scope.
>
> So I'm baffled.
>
> _______________________________________________
> 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://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-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20101027/581b4506/attachment.htm>


More information about the Insight-developers mailing list