[vtkusers] release memory allocated in vtk from python

Jothy jothybasu at gmail.com
Mon Jul 2 12:17:58 EDT 2012


I think the first one.

Jothy

On 02-Jul-2012, at 5:06 PM, José M. Rodriguez Bacallao <jmrbcu at gmail.com> wrote:

> 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
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list