I just tried calling subplot.clear() just before calling canvas.draw(). Interestingly enough it increases the memory leak rate by roughly 50%!

By the way, the minimal script is available here if you want to try it:
<http://www.astro.washington.edu/users/rowen/python/matplotlibMemoryLeak.py >

I would be interested to see your code if it is available. What back end are you using?

Regards,

-- Russell

On Dec 12, 2010, at 8:08 AM, Friedrich Romstedt wrote:

2010/12/12 Russell Owen <ro...@uw.edu>:
Simply creating a blank Axes and calling canvas.draw() leaks memory -- even without displaying any data or shifting the x axes.

Okay, as a workaround have you tried ax.clear()?

So the example script provided by you can be boiled down further?

I'm using ax.clear() in a layered approach very extensively and have
never noticed memory leaks with this.  I'm having a Layer object which
can be fed by data, and when the data changes, it automatically will
trigger an ax.clear() in the host stack, and then everything is
redrawn.  Not the fastest, but fast enough.

Friedrich

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to