Hi Michael and others, Sorry for the late answer. I am on Ubuntu 8.10. Unfortunately I have not had time to look any more into the issue (which might very well be an error on my part) but I will return when I have more info (I have made a temporary fix).
I tried using valgrind-massif to reproduce your plot but unfortunately newer versions of valgrind-massif do not support ps plots. Best regards, Jesper 2009/4/15 Michael Droettboom <md...@stsci.edu>: > I am not able to reproduce this leak here with 0.98.6svn from today on > RHEL4. What platform are you on? > > (See attached massif profile -- the memory usage is flat...) > > Mike > > Jesper Larsen wrote: >> >> Hi matplotlib developers and users, >> >> I have had some problems with a memory leak in a long running >> matplotlib based web application that I have developed >> (www.worldwildweather.com). I believe the problem is due to a memory >> leak in the Agg backend but I am not sure. Below is a script which for >> me results in a consistently increasing amount of memory usage. I am >> using mpl version 0.98.6svn. The problem does not occur when the >> savefig command is commented out. And it does not occur when "cs = >> ax.contourf(z)" and "ax.cla()" are moved outside the loop (before and >> after respectively). >> >> Best regards, >> Jesper >> >> import os, gc >> import numpy as npy >> import matplotlib as mpl >> from matplotlib.figure import Figure >> from matplotlib.backends.backend_agg import FigureCanvasAgg as >> FigureCanvas >> >> def report_memory(): >> """Report memory.""" >> gc.collect() >> pid = os.getpid() >> a2 = os.popen('ps -p %d -o rss,vsz,%%mem' % pid).readlines() >> return int(a2[1].split()[1]) >> >> fig = Figure(dpi=100) >> ax = fig.add_axes([0.1, 0.1, 0.8, 0.8]) >> FigureCanvas(fig) >> >> n = 1000 >> z = npy.zeros((n,n)) >> for i in range(2000): >> cs = ax.contourf(z) >> fig.savefig('test.png') >> ax.cla() >> print report_memory(), i >> >> I have not pasted in all of the output but just the first and last 25 >> lines: >> 53356 0 >> 53360 1 >> 53360 2 >> 53360 3 >> 53360 4 >> 53360 5 >> 53360 6 >> 53360 7 >> 53360 8 >> 53360 9 >> 53360 10 >> 53360 11 >> 53360 12 >> 53360 13 >> 53360 14 >> 53360 15 >> 53360 16 >> 53360 17 >> 53356 18 >> 53360 19 >> 53360 20 >> 53360 21 >> 53360 22 >> 53360 23 >> 53356 24 >> ... >> 57552 1975 >> 57552 1976 >> 57552 1977 >> 57552 1978 >> 57552 1979 >> 57552 1980 >> 57552 1981 >> 57552 1982 >> 57552 1983 >> 57552 1984 >> 57552 1985 >> 57552 1986 >> 57552 1987 >> 57552 1988 >> 57552 1989 >> 57552 1990 >> 57552 1991 >> 57552 1992 >> 57552 1993 >> 57552 1994 >> 57552 1995 >> 57552 1996 >> 57552 1997 >> 57552 1998 >> 57552 1999 >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by: >> High Quality Requirements in a Collaborative Environment. >> Download a free trial of Rational Requirements Composer Now! >> http://p.sf.net/sfu/www-ibm-com >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > -- > Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > > ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users