On Thursday, November 8, 2012, Carl Michal wrote:
> Hello,
>
> I noticed that a program I had that uses canvas.blit() to do animated
> graphs
> with the gtkagg backend was leaking memory.
>
> I tracked this down to gtk gc's being allocated in agg_to_gtk_drawable with
> gdk_gc_new(), but never being destroyed.
>
> The leak can be seen using the 'Animating selected plot elements' example
> from:
>
> http://www.scipy.org/Cookbook/Matplotlib/Animations
>
> (if it is modified to run forever, rather than just 50 plots and also
> changing numerix to numpy). After a few minutes, it is clear from ps that
> the
> memory usage is slowly but steadily climbing.
>
> Patch below (against matplotlib-1.1.1.) fixes it.
>
> Carl
>
> --- _gtkagg.cpp~ 2012-06-30 12:37:00.000000000 -0700
> +++ _gtkagg.cpp 2012-11-08 14:30:23.000000000 -0800
> @@ -121,6 +121,7 @@
> destbuffer,
> deststride);
>
> + gdk_gc_destroy(gc);
> if (needfree)
> {
> delete [] destbuffer;
>
>
>
>
If you are willing, would you like to file a PR against the v1.2.x branch?
Ben Root
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel