Garbage collection for glumpy figures?

Skip to first unread message

Alistair Muldal

Sep 26, 2012, 12:58:13 PM9/26/12
Hi all,

Does anyone know how to do garbage collection for a glumpy figure?

I have a class which displays movie frames inside a glumpy figure. Whenever an instance of the class is initialised I create glumpy.Image() instances for each frame, and when I close the figure and delete the UI object the frame data still remains in memory. If I open the UI more than 3-4 times I run out of RAM and start thrashing my hard disk, which is not much fun.

Normal garbage collection using gc.collect() doesn't seem to work, and from this page, it seems that I would need to call OpenGl.contextdata.cleanupContext(<context>) on the OpenGL context for the figure. However, I'm not an OpenGL expert, and I can't tell from the source code when the context is created and where it resides. I tried calling contextdata.cleanupContext(contextdata.getContext()) but that didn't seem to do the trick.

Any ideas?


Nicolas Rougier

Oct 1, 2012, 5:07:37 AM10/1/12

Would you have a short example code so I can see what' happening.
From what you've explained, there error could be related to the creation of a glumpy.Image() for each video frame. You might want to just "update" the image each time the underlying array is changed.

Reply all
Reply to author
0 new messages