[vtkusers] memory leak in vtkHyperStreamline

Lauren O'Donnell lauren at csail.mit.edu
Mon Feb 6 20:41:07 EST 2006


Hi all,

I have found a memory leak in vtkHyperStreamline.  The internal object
this->Streamers is allocated via new each time Execute is called, however it is
only deleted when the object itself is deleted.  So if the vtkHyperStreamline
object executes multiple times there is a leak, and also keeping even one copy
of the Streamers around is very very memory intensive for some reason.

The attached script demonstrates the problem (you need to run top or similar at
the same time and see how much memory is used).  There are some lines in the
script that you can uncomment to demonstrate the leak. I found that adding these
lines to the end of the function vtkHyperStreamline::Execute() will fix the
problem (must be after the call to BuildTube):

  delete [] this->Streamers;
  this->Streamers = 0;

Thanks for looking into this!

Lauren O'Donnell

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testVtkHyperStreamlineMemoryUse.tcl
Type: application/octet-stream
Size: 1671 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060206/eb2367a5/attachment.obj>


More information about the vtkusers mailing list