This source file calls gtk_container_get_children in various places which according to the Gtk docs "returns a newly allocated list" and is annotated "[transfer container]". This means the caller is responsible for freeing the list (but not the elements inside the list). However, tabwin.c does not do this and so (for example) holding down alt-tab for a long times causes it to leak relatively large amounts of memory. Valgrind log: ==20972== ==20972== 17,674,944 bytes in 736,456 blocks are indirectly lost in loss record 4,113 of 4,114 ==20972== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==20972== by 0x76BD718: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) ==20972== by 0x76D4922: g_slice_alloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) ==20972== by 0x76B3C95: g_list_prepend (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) ==20972== by 0x602A76E: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30) ==20972== by 0x5FFA409: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30) ==20972== by 0x602E0EA: gtk_container_get_children (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30) ==20972== by 0x43DAEA: tabwinChange2Selected (tabwin.c:901) ==20972== by 0x41A9D4: clientCycleEventFilter (cycle.c:329) ==20972== by 0x41C551: eventXfwmFilter (event_filter.c:158) ==20972== by 0x6619F30: ??? (in /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0.2400.30) ==20972== by 0x661B1E3: ??? (in /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0.2400.30) ==20972== ==20972== 35,346,312 (17,672,592 direct, 17,673,720 indirect) bytes in 736,358 blocks are definitely lost in loss record 4,114 of 4,114 ==20972== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==20972== by 0x76BD718: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) ==20972== by 0x76D4922: g_slice_alloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) ==20972== by 0x76B3C95: g_list_prepend (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) ==20972== by 0x602A76E: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30) ==20972== by 0x5FFA409: ??? (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30) ==20972== by 0x602E0EA: gtk_container_get_children (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30) ==20972== by 0x43DAEA: tabwinChange2Selected (tabwin.c:901) ==20972== by 0x41A9D4: clientCycleEventFilter (cycle.c:329) ==20972== by 0x41C551: eventXfwmFilter (event_filter.c:158) ==20972== by 0x6619F30: ??? (in /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0.2400.30) ==20972== by 0x661B1E3: ??? (in /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0.2400.30) ==20972== ==20972== LEAK SUMMARY: ==20972== definitely lost: 35,508,080 bytes in 1,479,323 blocks ==20972== indirectly lost: 17,784,238 bytes in 740,904 blocks ==20972== possibly lost: 2,300 bytes in 37 blocks ==20972== still reachable: 1,699,861 bytes in 15,446 blocks ==20972== of which reachable via heuristic: ==20972== length64 : 2,232 bytes in 33 blocks ==20972== newarray : 1,744 bytes in 29 blocks ==20972== suppressed: 0 bytes in 0 blocks ==20972== ==20972== For counts of detected and suppressed errors, rerun with: -v ==20972== Use --track-origins=yes to see where uninitialised values come from ==20972== ERROR SUMMARY: 77 errors from 49 contexts (suppressed: 0 from 0)
Created attachment 7617 fix leaks The attached patch fixes the leaks pointed out by Alistair, but they were not enough, there was also another leak in tabwin, css = gtk_css_provider_to_string (provider);
Can you please attach a "git format-patch" instead?
Created attachment 7632 git format patch Here you are.
Andre Miranda referenced this bugreport in commit 2fb59f21014b44dd36cce8740ad919f4cba608d3 Fix memory leaks in tabwin https://git.xfce.org/xfce/xfwm4/commit?id=2fb59f21014b44dd36cce8740ad919f4cba608d3
@ofourdan, shouldn't we close this bug?