From: Carl M. <mi...@ph...> - 2012-11-09 00:12:23
|
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; |