[vtk-developers] Leaks in the chemistry classes

David Lonie loniedavid at gmail.com
Mon Feb 13 16:54:22 EST 2012


Hi List,

Marcus and I have been trying to track down some memory leaks in the
new Chemistry kit. The two that are left are:

http://www.cdash.org/CDash/testDetails.php?test=134987704&build=2000996
http://www.cdash.org/CDash/testDetails.php?test=134987708&build=2000996

(The leaks:

Class "vtkBlueObeliskData" has 1 instance still around.
Class "vtkUnsignedShortArray" has 2 instances still around.
Class "vtkFloatArray" has 10 instances still around.
Class "vtkStringArray" has 7 instances still around.

have been fixed, but the rest are still there.)

The tests that generate these are here:

http://github.com/Kitware/VTK/blob/master/Chemistry/Testing/Cxx/TestMoleculeSelection.cxx
http://github.com/Kitware/VTK/blob/master/Chemistry/Testing/Cxx/TestCMLMoleculeReader.cxx

When I enable debugging for the CMLMoleculeReader in the test script,
I get the following:

[test starts]
[reader is created, vtkNew sets refcount = 1]
[debugging is enabled]
vtkCMLMoleculeReader (0x14457b0): Registered by
vtkStreamingDemandDrivenPipeline (0x1473de0), ReferenceCount = 2
vtkCMLMoleculeReader (0x14457b0): UnRegistered by NULL, ReferenceCount = 1
/usr/src/vtk/build/bin/ChemistryCxxTests exited with code 0

It looks like there is an instance of vtkStreamingDemandDrivenPipeline
holding a reference to the reader that
is leaking. Everything I'm allocating in the test uses vtkNew, so I'm
thinking that I must be doing something wrong inside the reader wrt
information-request handling. I've looked, but I don't see anything
suspicious. Is the reader responsible for freeing anything it receives
from the pipeline? The CML reader code that may have the bug is here:

http://github.com/Kitware/VTK/blob/master/Chemistry/vtkCMLMoleculeReader.cxx

I think something similar is happening with the MoleculeSelection
test. I don't seen anything obvious or suspicious in the code -- can
someone more familiar with the pipeline internals take a look at
these?

Thanks in advance,

Dave



More information about the vtk-developers mailing list