[Insight-users] Memory usage in WrapITK
Gaëtan Lehmann
gaetan.lehmann at jouy.inra.fr
Sat Jan 31 04:21:51 EST 2009
Le 31 janv. 09 à 06:16, Борис Казаков a écrit :
> Hi,
> I have tested the following example, written in python using wrapitk:
>
> import numpy as np
> import itk
> itk.auto_progress(2)
>
> image_type = itk.Image.F3
> duplicator = itk.ImageDuplicator[image_type].New()
> filter_type = itk.RecursiveGaussianImageFilter[image_type, image_type]
> reader = itk.ImageFileReader[image_type].New()
> reader.SetFileName('/home/borsh/test/im1.jpg')
> for i in range(400):
> print i
> ga = filter_type.New()
> gb = filter_type.New()
> ga.SetDirection(0)
> gb.SetDirection(1)
> ga.SetZeroOrder()
> gb.SetZeroOrder()
>
> ga.SetInput(reader.GetOutput())
> gb.SetInput(ga.GetOutput())
> duplicator.SetInputImage(gb.GetOutput())
> gb.Update()
>
> With each iteration of outer loop the memory usage of the python
> process increases. Am I doing something wrong or is there a memory
> leak in wrapitk?
Hi,
I think itk.auto_progress() can cause memory leaks - it's in my TODO
list.
Also, garbage collection can cause a memory increase in python,
because the filters are not immediately destroyed. A good practice is
to avoid instantiating a filter in a loop, but rather reusing an
existing filter in that loop.
Regards,
Gaëtan
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr http://www.mandriva.org
http://www.itk.org http://www.clavier-dvorak.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090131/5492b400/attachment.pgp>
More information about the Insight-users
mailing list