On Sun, Nov 11, 2012 at 4:23 PM, Benjamin Root <ben...@ou...> wrote:
>
>
> 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
Decided to follow-up on this and it looks like this patch has already
been applied.
--
Damon McDougall
http://www.damon-is-a-geek.com
Institute for Computational Engineering Sciences
201 E. 24th St.
Stop C0200
The University of Texas at Austin
Austin, TX 78712-1229
|