I am also finding the continuing increase in memory usage, but this also occurs 
with other backends (I tried tkagg and pdf) and also without the call to 
savefig. One possibility is a circular reference in the quiver function that 
prevents data from being cleaned up.

--Michiel


--- On Mon, 1/19/09, Damon McDougall <damon.mcdoug...@gmail.com> wrote:

> From: Damon McDougall <damon.mcdoug...@gmail.com>
> Subject: [matplotlib-devel] Memory leak using savefig with MacOSX backend?
> To: "matplotlib development list" <matplotlib-devel@lists.sourceforge.net>
> Date: Monday, January 19, 2009, 6:09 AM
> I'm looping over several files (about 1000) to produce a
> vector field plot for each data file I have. Doing this with
> the MacOSX backend appears to chew memory. My guess as to
> the source of the problem is the 'savefig' function
> (or possibly the way the MacOSX backend handles the saving
> of plots).
> 
> I opened Activity Monitor to watch the usage of memory
> increase. Below is code that recreates the problem.
> 
> [start]
> 
> import matplotlib
> matplotlib.use('macosx')
> matplotlib.rc('font',**{'family':'serif','serif':['Computer
> Modern Roman']})
> matplotlib.rc('text', usetex=True)
> from pylab import *
> 
> i = 0
> x = []
> y = []
> v1 = []
> v2 = []
> 
> while(True):
>       f = open("%dresults.dat"%i,"r")
>       for line in f:
>               x.append(float(line.split()[0]))
>               y.append(float(line.split()[1]))
>               v1.append(float(line.split()[2]))
>               v2.append(float(line.split()[3]))
>       f.close()
>       hold(False)
>       figure(1)
>       quiver(x, y, v1, v2, color='b',
> units='width', scale=1.0)
>       xlabel('$x$')
>       ylabel('$y$')
>       grid(True)
>       print i
>       savefig('graph-%05d.pdf'%i)
>       close(1)
>       x = []
>       y = []
>       v1 = []
>       v2 = []
>       i = i + 1
> 
> 
> [end]
> 
> Regards,
> --Damon
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword_______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


      

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to