|
From: Eric F. <ef...@ha...> - 2011-02-03 08:17:21
|
On 02/02/2011 08:38 PM, Robert Abiad wrote: > [...] > I'll put it in as an enhancement, but I'm still unsure if there is a bug in > there as well. Is there something I should be doing to clear memory after the > first figure is closed other than close()? I don't understand why memory usage > grows each time I replot, but I'm pretty sure it isn't desireable behavior. As > I mentioned, this effect is worse with plot. > > So is this a bug or improper usage? I'm not quite sure, but I don't think there is a specifically matplotlib memory leak bug at work here. Are you using ipython, and if so, have you turned off the caching? In its default mode, ipython keeps lots of references, thereby keeping memory in use. Also, memory management and reporting can be a bit tricky and misleading. Nevertheless, the attached script may be illustrating the problem. Try running it from the command line as-is (maybe shorten the loop--it doesn't take 100 iterations to show the pattern) and then commenting out the line as indicated in the comment. It seems that if anything is done that adds ever so slightly to memory use while the figure is displayed, then when the figure is closed, its memory is not reused. I'm puzzled. Eric > > As for how to implement a fix for memory usage, I'll let you folks figure that > out. But it seems that if I want a grayscale image, I could reduce memory usage > by 4 if matplotlib could turn rgba into intensity. > > -robert |