[ITK-users] PyBuffer memory consumption

Harnish, Roy Roy.Harnish at ucsf.edu
Thu Sep 1 17:39:42 EDT 2016


Hi,

I'm resurrecting a thread that I ran across trying to debug what looks to be a memory leak when using PyBuffer:

https://itk.org/pipermail/insight-users/2009-May/030386.html

If I repeatedly assign the output of itk.PyBuffer[ImageType].GetImageFromArray() to the same python variable name, more and more memory is consumed by the process. Wondering if anyone knows how to get this memory released? Here's some example code based on the linked thread that should reproduce the problem:

import itk
import numpy as np
import resource

M = []

for i in range(200):

  M.append(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)

  ImageType = itk.Image[itk.D, 3]
  converter = itk.PyBuffer[ImageType]

  inputNumpyVolume = np.ones((100, 100, 100))
  inputVolume = converter.GetImageFromArray(inputNumpyVolume)
#  inputVolume.Delete()

print M

Any suggestions much appreciated.

Roy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20160901/74ad9604/attachment.html>


More information about the Insight-users mailing list