GNOME Bugzilla – Bug 710230
possible leak in overview
Last modified: 2016-06-11 23:02:45 UTC
I am seeing quite a few of these leaks when entering overview. ==28649== 2,304 bytes in 18 blocks are definitely lost in loss record 24,490 of 26,069 ==28649== at 0x4C2A2DB: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==28649== by 0x4C2C74F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==28649== by 0x778A4B7: g_realloc (gmem.c:169) ==28649== by 0x774C795: g_ptr_array_maybe_expand (garray.c:1111) ==28649== by 0x774CE45: g_ptr_array_add (garray.c:1372) ==28649== by 0x4EADC30: add_matched_properties (st-theme.c:945) ==28649== by 0x4EADED3: _st_theme_get_matched_properties (st-theme.c:1009) ==28649== by 0x4EA5281: ensure_properties (st-theme-node.c:477) ==28649== by 0x4EA741A: _st_theme_node_ensure_geometry (st-theme-node.c:1682) ==28649== by 0x4EAB41E: st_theme_node_adjust_preferred_width (st-theme-node.c:3557) ==28649== by 0x4E8A98A: st_label_get_preferred_width (st-label.c:147) ==28649== by 0x69EA46D: clutter_actor_get_preferred_width (clutter-actor.c:9352) Also not sure if this is related but there are lots of these as well ==28649== 2,880 bytes in 40 blocks are possibly lost in loss record 24,659 of 26,069 ==28649== at 0x4C2C494: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==28649== by 0x778A444: g_malloc0 (gmem.c:134) ==28649== by 0x74E7D89: g_closure_new_simple (gclosure.c:206) ==28649== by 0x74E9E23: g_cclosure_new (gclosure.c:917) ==28649== by 0x7503E4D: g_signal_connect_data (gsignal.c:2462) ==28649== by 0x4EA4923: st_theme_node_new (st-theme-node.c:261) ==28649== by 0x4EAF5E6: st_widget_get_theme_node (st-widget.c:674) ==28649== by 0x4EAEBD3: st_widget_get_preferred_width (st-widget.c:404) ==28649== by 0x69EA46D: clutter_actor_get_preferred_width (clutter-actor.c:9352) ==28649== by 0x6A0AB13: get_child_size (clutter-box-layout.c:476) ==28649== by 0x6A0AD70: get_base_size_for_opposite_orientation (clutter-box-layout.c:555) ==28649== by 0x6A0B5D4: clutter_box_layout_get_preferred_width (clutter-box-layout.c:784)
Hmm we take a ref in st_widget_get_theme_node and unref in st_widget_dispose ...
So, StThemeNodes are cached forever by StThemeContext, so not freeing that block is correct, but why is valgrind marking it unreachable? The node is still in the global hash table and no memory is leaked.
The first message looks like a leak, but the latter is a red herring. It's a "possible" leak because a pointer to the beginning of the block couldn't be found, only one pointing into the middle of it -- in this case it's because g_closure_new_simple() reserves space for private data before the returned pointer. In my experience, Valgrind is almost always right about "definite" leaks, and almost always wrong about "possible" ones.
Created attachment 328913 [details] [review] 0001-theme-node-Fix-leak-on-stylesheet-change.patch Patch that fixes the leak. I can commit this myself if/when it passes review.
Review of attachment 328913 [details] [review]: looks good, thanks
hey hpj! thanks for working on this :-)
Comment on attachment 328913 [details] [review] 0001-theme-node-Fix-leak-on-stylesheet-change.patch Thanks for the fast review!