[vtkusers] VTK not releasing memory, including minimal example.

P.J.Schaafsma jetze.schaafsma at gmail.com
Sat Sep 29 13:17:47 EDT 2012


The camera thing didn't work. Didn't rerun valgrind yet, but I don't expect
any results from it, especially since the builtin VTK memory leak thing
worked flawlessly. Furthermore, scouring the internet leads me to believe
that this is a genuine issue of memory hogging, not leaking, which has
appeared on various forums under different titles, all unsolved.


Anyway, memory use increases in several steps. This is from the python code
using also the wxVTKRenderWindowInteractor. I'll type what I find as I go.
Hope it helps.

Set up


After setting up, just a vtkRenderer inside a basic wxFrame, the python.exe
process uses about 40Mb.

Load data


After loading the data, and running a VTK pipeline that will get me some
polydata (10Mb on disk), memory use is about 130MB.

First render


After initial loading of the data, at first render, memory use is increased
during vtkPolygonsPainter, lines 309 to 316 to about 180Mb:

      vtkDrawPolysMacro(primitive, 
        device->SendAttribute(vtkPointData::NORMALS, 3,
          ntype, normals, 3**ptIds);
        device->SendAttribute(vtkPointData::SCALARS, 3,
          VTK_UNSIGNED_CHAR, colors + 4**ptIds);
        device->SendAttribute(vtkPointData::NUM_ATTRIBUTES, 3,
          ptype, points, 3**ptIds);,;,;);
      break;

This appears to be the memory used by a display list, as evidenced by the
line 159 to 163 in vtkOpenGLDisplayListPainter.cxx, and therefore a
reasonable, but vtkOpenGLDisplayListPainter::ReleaseList does not appear to
be called anywhere in VTK, except in vtkOpenGLGlyph3DMapper.cxx. This is
almost certainly another bug (after the weird vtkCamera issue).

First render, continued


As far as I can track the calls to VTK, memory use doesn't increase until we
get to some wx stuff, at which point it increases again to about 270Mb, but
this is still before the Render call to the wxvtkinteractor from python
ends. Of course, this could be related to wx or python.

Interaction


If I then leave the window be, memory stays at 270Mb, but when I start
zooming or rotating, it increases again to over 400Mb. 

So, in the end, displaying a simple 500k triangle mesh takes up over 400Mb
of memory. Now that's excessive! After I delete the actor, and remove all
python objects, even the renderer!!, memory use is still 270Mb.




--
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-not-releasing-memory-including-minimal-example-tp5716258p5716364.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list