From: Michael D. <md...@st...> - 2008-07-14 19:35:38
|
Which backend? Cheers, Mike Manuel Metz wrote: > Michael Droettboom wrote: >> Thanks for the report. So we can diagnose this, what version of >> matplotlib are you reporting this for? >> >> Also, you may be interested in the following FAQ (and the one >> following it): >> >> http://matplotlib.sourceforge.net/faq.html#LEAKS > > Hi, > > I tested this with the lastest svn, and I do also see a leak. But > it's not related to twinx, but to pylab.close(). If I just comment out > this one line, the memleak disappears ... > > Manuel > >> Cheers, >> Mike >> >> laurent oget wrote: >>> i forgot two imports. >>> >>> import math >>> import gc >>> import pylab as PL >>> >>> >>> def looptest(): >>> while(1): >>> fig=PL.figure(1) >>> ax=fig.add_subplot(211) >>> ax.set_position((0,0,0.9,0.45)) >>> ax1=PL.twinx(ax) >>> t=range(1000) >>> st=[math.sin(x*0.01) for x in t] >>> ax.plot(t,st) >>> fig.clf() >>> PL.close(1) >>> gc.collect() >>> print "GC" >>> print len(gc.get_objects()) >>> print len(gc.garbage) >>> looptest() >>> 2008/7/11 laurent oget <la...@og... <mailto:la...@og...>>: >>> >>> I think i narrowed down the memory leak i have been chasing for a >>> while. >>> If i remove the call to twinx i get a slow leak, which would cause >>> me trouble >>> after a very long time. With the call to twinx, however i am >>> losing thousands of objects >>> at each loop. >>> >>> Thanks, >>> >>> Laurent >>> >>> >>> >>>>>>>>>>>>>>>>>>>>>>>>> import pylab as PL >>> def looptest(): >>> while(1): >>> fig=PL.figure(1) >>> ax=fig.add_subplot(211) >>> ax.set_position((0,0,0.9,0.45)) >>> ax1=PL.twinx(ax) >>> t=range(1000) >>> st=[math.sin(x*0.01) for x in t] >>> ax.plot(t,st) >>> fig.clf() >>> PL.close(1) >>> gc.collect() >>> print "GC" >>> print len(gc.get_objects()) >>> print len(gc.garbage) >>> looptest() >>> >>>>>>>>>>>>>>>>>>>>>>>>>>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> >>> ------------------------------------------------------------------------- >>> >>> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >>> Studies have shown that voting for your favorite open source project, >>> along with a healthy diet, reduces your potential for chronic lameness >>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08 >>> ------------------------------------------------------------------------ >>> >>> >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> 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 |