pyplot.figure() memory leak?

Hi!

This simple loop:

import time
import pylab
for i in range(100):

... time.sleep(0.1)
... pylab.figure()
...
will have python use more and more memory. While this is not technically a memory leak, it becomes one in practice, if I want to create a large number of figure objects. How can I free the memory used by one or all figure objects?

Cheers
Paul

2011/3/8 Paul Anton Letnes <paul.anton.letnes@...287...>:

Hi!

This simple loop:

import time
import pylab
for i in range(100):

... time.sleep(0.1)
... pylab.figure()
...
will have python use more and more memory. While this is not technically a memory leak, it becomes one in practice, if I want to create a large number of figure objects. How can I free the memory used by one or all figure objects?

Your code creating many objects is not a memory leak. You can reuse
figures or dispose of them calling pylab.close(). See docstrings for
pylab.close and pylab.clf.

Goyo