[vtk-developers] Query about vtkDebugLeaks

Deepak Surti dmsurti at gmail.com
Mon Jan 26 02:17:29 EST 2015


Please ignore this question:

*Also, if I write a test case to ensure no memory leaks are reported, I
cannot use the test: vtk.vtkDebugLeaks.PrintCurrentLeaks() == 0. Or if the
above are indeed not leaks, but only reports, will
vtk.vtkDebugLeaks.PrintCurrentLeaks() == 1 be a reliable test case? *

I read the vtkDebugLeaks docs and obviously it runs non-zero if there were
leaks, I was thinking it prints number of leaks detected. Anyways, in that
case, how do I write a test to ensure no leaks are happening?

Thanks,
Deepak

On Mon, Jan 26, 2015 at 12:33 PM, Deepak Surti <dmsurti at gmail.com> wrote:

> Hi,
>
> I am using vtkDebugLeaks. Using this example here:
> http://www.vtk.org/Wiki/VTK/Examples/Python/DataManipulation/Cube.py, if
> I *insert this line* : (after lines 10 and 82 in main function):
>
> vtk.vtkDebugLeaks.PrintMemoryLeaks()
>
> when, I run the script, I get the following on the console:
>
> vtkDebugLeaks has detected LEAKS!
> Class "vtkObjectFactoryCollection" has 1 instance still around.
> Class "vtkBoxMuellerRandomSequence" has 1 instance still around.
> Class "vtkMinimalStandardRandomSequence" has 1 instance still around.
>
> vtkDebugLeaks has detected LEAKS!
> Class "vtkObjectFactoryCollection" has 1 instance still around.
> Class "vtkBoxMuellerRandomSequence" has 1 instance still around.
> Class "vtkMinimalStandardRandomSequence" has 1 instance still around.
>
> If I comment out all the del <python_obj> lines in the script, obviously I
> get a whole lot of memory leaks detected, as expected.
>
> My question is about the 3 leaks detected as in the trace above, with all
> the del <python_obj> in place.
>
> Are these 3 not leaks, but reports created by static initializers (as
> mentioned by David E DMarie here:
> http://vtk.1045678.n5.nabble.com/vtkDebugLeaks-problems-td5594643.html).
>
> Also, if I write a test case to ensure no memory leaks are reported, I
> cannot use the test: vtk.vtkDebugLeaks.PrintCurrentLeaks() == 0. Or if the
> above are indeed not leaks, but only reports, will
> vtk.vtkDebugLeaks.PrintCurrentLeaks() == 1 be a reliable test case?
>
> I have attached 2 python scripts for reference, cube.py (with
> vtk.vtkDebugLeaks and del <<python_object>> statements in place) and
> cube_mem_leaks.py (vtk.vtkDebugLeaks and del <<python_object>> statements
> removed.)
>
> Thanks,
> Deepak
>
> --
> http://deepaksurti.com
> To see a miracle, be the miracle.
>



-- 
http://deepaksurti.com
To see a miracle, be the miracle.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150126/e68bb939/attachment.html>


More information about the vtk-developers mailing list