[EMAIL PROTECTED] wrote:
> 
> I'm producing series of plots (spectograms) in a program loop using 
> imshow and saving each plot to .png.  Even though I close() each plot 
> after each savefig(...), the memory does not appear to be freed up, and 
> the memory useage goes up and up as the program runs (and stalls the 
> computer as it thrashes the page file).
> 
> This is the essence of the code:
> 
> for i in range(..):
>     pylab.imshow(logPSDs[i]...)
>     pylab.colorbar()
>     pylab.savefig(plotName[i])
>     pylab.close()
> 
> Is there anything that I should be doing to stop this memory "wastage"? 
>  (The plots themselves are fantastic!)

There seem to be big memory leak problems with all interactive backends. 
  It looks like you don't need an interactive backend.  If this is the 
case, then instead of starting with "import pylab", try:

import matplotlib
matplotlib.use('Agg')
import pylab

Eric

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to