After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 710230 - possible leak in overview
possible leak in overview
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: overview
3.10.x
Other Linux
: Normal normal
: ---
Assigned To: Hans Petter Jansson
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2013-10-16 00:17 UTC by darkxst
Modified: 2016-06-11 23:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-theme-node-Fix-leak-on-stylesheet-change.patch (1.88 KB, patch)
2016-06-01 21:52 UTC, Hans Petter Jansson
committed Details | Review

Description darkxst 2013-10-16 00:17:18 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)
Comment 1 drago01 2013-10-20 12:28:35 UTC
Hmm we take a ref in st_widget_get_theme_node and unref in st_widget_dispose ...
Comment 2 Giovanni Campagna 2013-10-21 19:23:19 UTC
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.
Comment 3 Hans Petter Jansson 2016-06-01 21:49:17 UTC
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.
Comment 4 Hans Petter Jansson 2016-06-01 21:52:01 UTC
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.
Comment 5 Rui Matos 2016-06-02 12:39:16 UTC
Review of attachment 328913 [details] [review]:

looks good, thanks
Comment 6 Ray Strode [halfline] 2016-06-02 12:41:03 UTC
hey hpj! thanks for working on this :-)
Comment 7 Hans Petter Jansson 2016-06-11 23:02:00 UTC
Comment on attachment 328913 [details] [review]
0001-theme-node-Fix-leak-on-stylesheet-change.patch

Thanks for the fast review!