From: Albert K. <alb...@gm...> - 2013-05-28 17:30:37
|
Correct. On Tue, May 28, 2013 at 9:42 AM, zetah <ot...@hu...> wrote: > Albert Kottke wrote: > > > >I had this problem as well. I think my solution was to tell the > >garbage collector to collect. > > > >import gc > >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) > > gc.collect() > > > >I tried to test this with Python3.3, but didn't have any issues > >with memory increasing when using 'plt.close'. > > > Thanks Albert, that indeed does the trick :) > > If I understand your last sentence, you are saying garbage collector > intervention isn't needed for Python 3.3. > > > Cheers > > |