[vtkusers] VTK/Python GetOutput memory leak

Lachlan Hurst lachlan at vpac.org
Thu Mar 11 22:12:28 EST 2004


Hi,
Firstly I'd like to give a big thanks to Yves Starreveld, the little work around performed well for my application.  As pointed out by Yves calling the GetOutput method in python does result in a memory leak, as also pointed out by Yves this can be worked around by the use of the SetOutput and Update method.  The problem I have at the moment is I wish to obtain multiple outputs for the source - necessitating multiple GetOutput(int index) calls.  The code goes something like follows.

EnsightReader = vtk.vtkEnsightReader()
vtkGRIDEnsight = vtk.vtkUnstructuredGrid()
appendFilter = vtk.vtkAppendFilter()
tmp = vtk.vtkUnstructuredGrid()

for i in range(EnsightReader.GetNumberOfOutputs()):
     tmp  = EnsightReader.GetOutput(i)
     self.appendFilter.AddInput(tmp)

self.appendFilter.SetOutput(vtkGRIDEnsight)  
self.appendFilter.Update()
self.MakeEnsightActors()

This code works, but leaks like a sieve. To my knowledge there's no Setoutput method by output index, can anyone out there think of another possible workaround?
>From the above code you may have noticed that I really only want one output from the vtkEnsightReader- another possible workaround may be to tell the reader to give only one output (with everything in it!) instead of an output for every part.
Any help would be greatly appreciated, Thanks.
Lachlan Hurst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040312/90b1a833/attachment.htm>


More information about the vtkusers mailing list