Hi all, is there some way to clean up all the memory used
> by matplotlib? I currently have a script which creates a
> bunch of plots and it seems to use an increasing amount of
> memory until my m/c runs out of memory and swap space. I'm
> forcing the gc to collect after every plot is generated
> (and saved to disc) and that doesn't help. Looking through
> the list of types that the gc is holding it seems like the
> vast majority of them are objects generated by
> matplotlib. I'm pretty sure now that it's not an issue with
> the data structures I'm creating, so ... any ideas?
Are you using pylab? If so, most likely you are creating but not
closing figures. You need to pair every use of pylab figure with a
pylab close. Feel free to post an example script.
> If it helps, I'm using matplotlib 0.87 on Fedora Core 4
> with numpy 0.9.5. I've run the memory test code in
> http://matplotlib.sourceforge.net/faq.html#LEAKS and got
> the following:
> Average memory consumed per loop: -0.1083k bytes
Good -- this indicated matplotlib proper is not leaking, so it is a
figure management problem. You may want to inspect _pylab_helpers to
see if it is storing references you don't want it to.
Another alternative is to not use pylab for figure management. The
best approach here depends on what kinds of batch figures you are
trying to create (GUI vs hardcopy).