Talk:Matplotlib
From Wikipedia, the free encyclopedia
[edit] Claim of memory leaks
On the article page, I claimed that "as of October 2005, basic plotting commands in Matplotlib suffer from memory leaks." Someone will probably dispute me on that (or perhaps show how it can be avoided). Here's how I tested for memory leaks:
>>> from pylab import * >>> plot(range(10000), range(10000)) >>> show() >>> plot(range(10000), range(10000)) >>> plot(range(10000), range(10000)) >>> plot(range(10000), range(10000)) >>> plot(range(10000), range(10000)) >>> plot(range(10000), range(10000)) >>> plot(range(10000), range(10000))
Note how the process memory usage increases continuously with each new plot command. - Connelly 00:58, 14 October 2005 (UTC)
Yep, someone will dispute you:-). matplotlib by default does not clear the previous plot, so you are adding many equivalent lines to the same plot. memory leaks in matplotlib have been hunted down agressively for many releases: there are FAQs about them and unit tests to detect them. To prevent the so-called leak in your example, set the hold rc property to False., or plor with plot(x,y,hold=False).
May I humbly suggest that you learn matplotlib, read it FAQ, and post to the user's list before posting disparaging comments on the wikipedia. Your, the matplotlib author, John Hunter.