From: zetah <ot...@hu...> - 2013-05-28 16:42:53
|
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 |