I can confirm this. Commenting out "del Gcf.figs[num]" in Gcf.destroy (in _pylab_helpers.py) also seems to resolve the leak. But I have no idea why, so I won't commit it just yet. I don't have much time to look deeper now. Does anyone (who probably understands figure management better than me) have an idea what might cause this?
Cheers, Mike Manuel Metz wrote: > Michael Droettboom wrote: >> Which backend? > > GTK, GTKAgg, TK, but not with any backend without a window: Agg, > Cairo, PS, PDF, SVG ... > > Cheers, > Manuel > >> 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 <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>: >>>>> >>>>> 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 >>>>> 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 ------------------------------------------------------------------------- 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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users