[vtkusers] Memory leak vtkEnsightGoldReader in Python
Bernhard Righolt
b.w.righolt at tudelft.nl
Thu Feb 27 03:20:39 EST 2014
Dear all,
Currently I am using a Python script to process information stored in the
EnSight Gold format. My Python (2.6) scipt uses VTK (5.10.0) to process the
file, where I used the vtkEnSightGoldReader for reading the data, and loop
over time steps.
In principle this works fine for smaller datasets, however, for large
datasets (i.e. 11k files of 12MB), I see the memory usage (recorded via
top) increasing with time while the process is running. This filling of the
memory goes slow, but in some cases problems are inevitable. Apparently, I
am doing some things wrong in my script with respect to memory management.
I am using the following script (stripped obviously, but still showing this
issue)
import vtk
reader = vtk.vtkEnSightGoldReader()
reader.SetCaseFileName("case.case")
reader.Update()
# Get time values
timeset=reader.GetTimeSets()
time=timeset.GetItem(0)
timesteps=time.GetSize()
#reader.ReleaseDataFlagOn()
for j in range(timesteps):
curTime=time.GetTuple(j)[0]
print curTime
reader.SetTimeValue(curTime)
reader.Update()
#reader.RemoveAllInputs()
I tried a few things as you can see
- reader.ReleaseDataFlagOn(), without success
- reader.RemoveAllInputs(), did not get it to run
- running gc.collect at the end of the loop, following
http://vtk.1045678.n5.nabble.com/VTK-memory-management-td5715661.html
- Using DeepCopy as suggested here:
http://vtk.1045678.n5.nabble.com/Memory-leak-in-VTK-Python-module-td1234002.htmlHowever,
I am already experiencing this without a call to GetOutput
My question is, how can I properly unload/replace the data that is stored
in the memory, instead of using more memory continuously?
Best regards,
Bernhard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140227/34ef5876/attachment.html>
More information about the vtkusers
mailing list