On 2010-07-14 18:51:26 +0200, K.-Michael Aye said: > On 2010-07-14 18:45:35 +0200, John Hunter said: > >> On Wed, Jul 14, 2010 at 11:38 AM, K.-Michael Aye >> <kmichael....@gmail.com> wrote: >> >>> Out[12]: 1 >>> >>> In [13]: gc.collect() >>> >>> Out[13]: 12 >> >> >> still not seeing a leak in your data -- you need to report_memory >> after calling gc collect. Turn off hold, add an image, call collect, >> report memory, the repeat several times, each time calling collect and >> report memory, and report the results. > > Was just following your example, you were nowhere calling collect. > Here is what you requested: > > In [1]: import gc > > In [2]: import matplotlib.cbook as cbook > > In [3]: data = ones((1500,1500,3)) > > In [4]: hold(False) > > In [5]: imshow(data) > > Out[5]: <matplotlib.image.AxesImage object at 0x1c43e50> > > In [6]: gc.collect() > > Out[6]: 12 > > In [7]: cbook.report_memory() > > Out[7]: 174540 > > In [8]: imshow(data) > > Out[8]: <matplotlib.image.AxesImage object at 0x1c59e90> > > In [9]: gc.collect() > > Out[9]: 0 > > In [10]: cbook.report_memory() > > Out[10]: 253400 > > In [11]: imshow(data) > > Out[11]: <matplotlib.image.AxesImage object at 0x1c603b0> > > In [12]: gc.collect() > > Out[12]: 0 > > In [13]: cbook.report_memory() > > Out[13]: 333360 > > In [14]: imshow(data) > > Out[14]: <matplotlib.image.AxesImage object at 0x1c60410> > > In [15]: gc.collect() > > Out[15]: 0 > > In [16]: cbook.report_memory() > > Out[16]: 413296 >
Here are the commands as macro form, for easy cut and paste into pylab: import gc import matplotlib.cbook as cbook data = ones((1500,1500,3)) hold(False) imshow(data) gc.collect() cbook.report_memory() imshow(data) gc.collect() cbook.report_memory() imshow(data) gc.collect() cbook.report_memory() imshow(data) gc.collect() cbook.report_memory() > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users