GNOME Bugzilla – Bug 59893
Growing memory usage during execution of application
Last modified: 2011-02-04 16:09:32 UTC
When I was playing with memprof and random gtk+2 apps, I found out that the memory usage of those apps grows during execution. For example, I started the gtk-demo program. After moving with the mouse over the TreeView for about 10 seconds, the total memory usage of the program was 1Mb larger. This does not only happen with the TreeView, the ButtonBox example, for example, has the same problem.
If you do it for a long time then hit profile, presumably the cause of hte problem will be at the top of the profile. (Assuming you already tried the leak detection approach...)
Oops, forgot about the profiles. I talked with Owen on IRC about this. He told me that a diff between two profiles could be useful. Anyway, the upcoming two attachments are, a) a profile after 2 minutes of 'playing' with gtk-demo and b) a diff between the profile after startup and the profile after 'playing' with gtk-demo. Between the two profiles, the memory usage of the program grew about 6 Mb.
Created attachment 5041 [details] Memprof profile after 2 minutes of usage
Created attachment 5042 [details] [review] Diff between the two profiles
Created attachment 5634 [details] a simple test application that calls gtk_label_set_text() from a timeout and leaks
Created attachment 5918 [details] [review] GtkButton leak fix
I ran the program under memprof and discovered a leak in GtkButton. It didn't fix the increasing memory usage. A profile reveals: g_signal_emit_valist children: signal_emit_unlocked_R: 1112630 total: 1112630 self: 0 inherited: g_signal_emit: 320 gtk_signal_emit: 346735 gtk_signal_emit_by_name: 765575
Just a small note, I just discovered anders had a fix for the GtkButton mem leak here. It has already been fixed, so that patch shouldn't go in.
I think the main thing that is being seen here is a memprof bug, in some exploration, real changes don't seem to show up in the memprof profiles, and they don't show up in top, so something isn't being subtracted from memprofs toal allocations count. (I do see a small increase in total size in top, so I won't close this bug just yet.)
I'm going to close this bug, since it's too vague to be useful "look for mem leaks and fix any you find".