[vtkusers] release memory allocated in vtk from python

José M. Rodriguez Bacallao jmrbcu at gmail.com
Mon Jul 2 12:06:32 EDT 2012


hi folks, how to correctly release memory using vtk from python
for example, which one of this three code snnipets release the memory
allocated when reading the file:

def test(filename):
    r = vtkgdcm.vtkGDCMImageReader()
    r.SetFileName(filename)
    r.Update()
    img = vtk.vtkImageData()
    img.DeepCopy(r.GetOutput())
    return img
--------------------------------------------------------------------------
def test(filename):
    r = vtkgdcm.vtkGDCMImageReader()
    r.SetFileName(filename)
    r.Update()
    return r.GetOutput()
---------------------------------------------------------------------------
 r = vtkgdcm.vtkGDCMImageReader()
 r.SetFileName(filename)
 r.Update()
img = r.GetOutput()
img = None
del img
r = None
del r



More information about the vtkusers mailing list