[vtkusers] To use vtkSmartPointer or not use (Memory Leak)

David E DeMarle dave.demarle at kitware.com
Sat Oct 6 06:28:05 EDT 2012


If vtkdebugleaks passes, it means that no vtk objects are left. It doesn't
say anything about you own buffers and data structures.
Run it through valgrind to find out what non vtk references are not freed.

On Saturday, October 6, 2012, cel02000 wrote:

> Dear All,
>
> I have developed a VTK code for my Ph.D thesis since 8 months ago. It is
> now
> about 7000 lines. At the beginning, I had a problem in passing
> vtkSmartPointer to functions. I posted my question here and was advised not
> to use vtkSmartPointer and instead use c++ pointer as function arguments.
> Everything worked really well by not using vtkSmartPointer as a function
> argument and I did not encounter any problem. Now after 8 months, I have
> developed all parts of the code for my thesis. It is working fine. However,
> I noticed that my code has severely bad memory leak.
>
> In the code, I have to loop the main function 10 times. When I look at
> Windows Task Manager, I notice that the memory increases from 3GB to 47GB.
> I
> have deleted all the created VTK instances using ->Delete(). I also used
> vtkDebugLeaks to see if I have memory leak. It did not report any memory
> leak. I searched and found a post that we should use vtkSmartPointer to
> avoid memory leaks. I am now confused. I would be very grateful if someone
> could help me how I can fix the memory leak in my code. Am I able to solve
> the memory leak with minimal changes to my code? Or I should fundamentally
> modify it.
>
> Regards,
> Ahmad
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/To-use-vtkSmartPointer-or-not-use-Memory-Leak-tp5716501.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>


-- 
David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121006/ef9ff714/attachment.htm>


More information about the vtkusers mailing list