[vtkusers] VTK not releasing memory, including minimal example.
jetze.schaafsma at gmail.com
Sun Sep 23 09:57:52 EDT 2012
The code below illustrates a problem where VTK fails to release memory. The
amount of memory the program uses at the very end, when all actors have been
removed and the interactor starts, grows approximately linearly with the
number of iterations.
It comes down to this. If I comment 'key line #1' then the eventual memory
consumption is in the 10s of Mbs, irrespective of the number of iterations.
Otherwise, it grows into the hundreds quickly. So at the application code
leve,l the Render call causes the issue (hence the mapper.Update() call to
force the pipeline to execute). The volume.vti dataset is about 8Mb on disk.
The problem persists in many configurations. I've tested with:
VTK 5.6.1 / VTK 5.10.0
Win7-64 / Kubuntu 12.04-64
Python 2.7 / C++
RelWithDeb / Debug VTK builds.
Pipelined / non-pipelined VTK (using Update/GetOutput/SetInput vs
I've been working on it for quite some time now, trying many different
solutions I found in various forum post, but of course there's a chance I've
missed the correct one. Using the DataReleaseFlag in various ways either
made no difference, or produced incorrect results (not showing anything in
de render window).
- Is it an issue, or is this somehow by design?
- Am I missing crucial method calls that would cause this issue?
- Can anyone confirm the issue?
- What else can I try?
The Python code
renderer = vtk.vtkRenderer()
render_window = vtk.vtkRenderWindow()
interactor = vtk.vtkRenderWindowInteractor()
actors = 
for i in range(1):
reader = vtk.vtkXMLImageDataReader()
contour = vtk.vtkContourFilter()
mapper = vtk.vtkPolyDataMapper()
actor = vtk.vtkActor()
# key line #1
for actor in actors:
reader = None
contour = None
mapper = None
actor = None
# key line #2
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-not-releasing-memory-including-minimal-example-tp5716258.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers