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

cel02000 cel02000 at yahoo.com
Sat Oct 6 01:18:24 EDT 2012


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.



More information about the vtkusers mailing list