[vtk-developers] Leaks in the chemistry classes

Biddiscombe, John A. biddisco at cscs.ch
Tue Feb 14 11:30:42 EST 2012


parser->SetTarget(output);
try calling

parser->SetTarget(NULL);



before you delete. There might be a dangling reference held onto there...



just a thought as I was tired of work and glanced at your code. Probably no help.



JB


From: vtk-developers-bounces at vtk.org [mailto:vtk-developers-bounces at vtk.org] On Behalf Of Pat Marion
Sent: 14 February 2012 16:26
To: David Lonie
Cc: VTK Developers
Subject: Re: [vtk-developers] Leaks in the chemistry classes

One possible reference leak, do you need to call this->SetTarget(NULL) in the parser's destructor?

Pat
On Mon, Feb 13, 2012 at 4:54 PM, David Lonie <loniedavid at gmail.com<mailto:loniedavid at gmail.com>> wrote:
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
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20120214/de96fdc8/attachment.html>


More information about the vtk-developers mailing list