On 03/23/2012 08:05 AM, Albert Kottke wrote:
> I am having problems clearing figures from memory. After saving the
> figure, I use pyplot.close() on the figure handle and then del all of
> the data and figure, as shown here:
>
> fig.savefig('plots/%(record_id)05i' % recording)
> plt.close(fig)
>
> del accel, fourier_amp, fig, time, disp
> gc.collect()
>
> Despite this, the figures don't appear to be closing. I am trying to
> make 30k plots and I have to kill script every couple thousand and
> restart because I run out of memory.
>
> Any suggestions?

You are running a standalone script, correct?  Make sure you are using 
only the agg backend.  Before the first import of pyplot, do

import matplotlib
matplotlib.use("agg")

I don't know if that will help, but it can't hurt.

You might find matplotlib.cbook.report_memory() to be useful in tracking 
down the problem.

Eric

>
>
> Albert
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to