On 2013/05/27 9:51 PM, zetah wrote: > Hi, > > if I use something like this: > > ================================================== > import numpy as np > import matplotlib.pyplot as plt > > def draw_fig(arr, fn): > fig = plt.figure() > ax = fig.add_subplot(111) > ax.contourf(arr) > plt.savefig(fn)
plt.close(fig) # that should take care of it > > if __name__ == '__main__': > for i in range(10): > draw_fig(np.random.random((10, 10)), 'fig_%02d.png' % i) > ================================================== > > memory usage grows with every loop, so I can't plot this way many sequences. > > I know there is animation class in Matplotlib, but this way is easier to me, > and I think I miss something fundamental because this is happening. How can I > avoid memory leak using this approach? > > Thanks > > > ------------------------------------------------------------------------------ > Try New Relic Now & We'll Send You this Cool Shirt > New Relic is the only SaaS-based application performance monitoring service > that delivers powerful full stack analytics. Optimize and monitor your > browser, app, & servers with just a few lines of code. Try New Relic > and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users