pylab/matplotlib large plot memory management - bug? or tuning parameter needed?
Johan Grönqvist
johan.gronqvist at gmail.com
Tue Oct 20 03:48:57 EDT 2009
bdb112 skrev:
> Summary:
>
> It is not straightforward to avoid memory leaks/consumption in pylab.
> If we define
> x = arange(1e6) # adjust size to make the increment visible, yet
> fast enough to plot
> # then repetition of
> plot(x,hold=0) # consumes increasing memory according to ubuntu
> system monitor
> [...]
I do not know what closing the window does, but in my programs, running
on debian and opensuse, I found that explicitly calling close() solved
my memory leaks with matplotlib.
> 3/ Are there python/matplotlib memory management tuning parameters I
> can tweak?
You could try to import gc, and then call gc.collect() after each call
to close().
docs at: http://docs.python.org/library/gc.html
Hope it helps
/ johan
More information about the Python-list
mailing list