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 678059 - memory leak in pango_layout_get_extents
memory leak in pango_layout_get_extents
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: pango-maint
pango-maint
Depends on:
Blocks:
 
 
Reported: 2012-06-14 00:40 UTC by Robert Ancell
Modified: 2012-06-14 01:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test case showing leak (694 bytes, text/x-csrc)
2012-06-14 00:40 UTC, Robert Ancell
  Details
Free mutex on hb_block destruction (1.18 KB, patch)
2012-06-14 00:42 UTC, Robert Ancell
committed Details | Review

Description Robert Ancell 2012-06-14 00:40:12 UTC
Created attachment 216360 [details]
Test case showing leak

With the attached test case there seems to be a memory leak in pango_layout_get_extents:

==7802== 4,000 bytes in 100 blocks are possibly lost in loss record 531 of 539
==7802==    at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7802==    by 0x5B5683E: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3301.0)
==7802==    by 0x5B56B08: g_mutex_init (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3301.0)
==7802==    by 0x5AEF075: g_mutex_new (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3301.0)
==7802==    by 0x5AEF374: g_static_mutex_get_mutex_impl (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3301.0)
==7802==    by 0x4E423B6: hb_blob_lock (hb-blob.c:194)
==7802==    by 0x4E44804: _hb_sanitize_init(_hb_sanitize_context_t*, _hb_blob_t*) (hb-open-type-private.hh:152)
==7802==    by 0x4E5306C: Sanitizer<GPOS>::sanitize(_hb_blob_t*) (hb-open-type-private.hh:275)
==7802==    by 0x4E4765C: _hb_ot_layout_init (hb-ot-layout.cc:55)
==7802==    by 0x4E43914: hb_face_create_for_data (hb-font.cc:182)
==7802==    by 0x4E40BE9: pango_ot_info_get (pango-ot-info.c:133)
==7802==    by 0x80663C4: basic_engine_shape (basic-fc.c:210)
==7802==    by 0x5089F59: pango_shape (shape.c:55)
==7802==    by 0x506D37C: shape_run (pango-layout.c:3183)
==7802==    by 0x506D67B: process_item (pango-layout.c:3294)
==7802==    by 0x508020A: pango_layout_check_lines (pango-layout.c:3592)
==7802==    by 0x5081016: pango_layout_get_extents_internal (pango-layout.c:2490)
==7802==    by 0x4E39A71: pango_fc_font_get_metrics (pangofc-font.c:573)
==7802==    by 0x507D15F: pango_layout_get_empty_extents_at_index (pango-layout.c:4435)
==7802==    by 0x507FAFF: pango_layout_line_get_extents (pango-layout.c:4470)
==7802==    by 0x507FC06: get_line_extents_layout_coords (pango-layout.c:2437)
==7802==    by 0x50810D4: pango_layout_get_extents_internal (pango-layout.c:2548)
==7802==    by 0x4009A5: main (pango_leak.c:24)
Comment 1 Robert Ancell 2012-06-14 00:42:11 UTC
Created attachment 216362 [details] [review]
Free mutex on hb_block destruction

This seems to resolve at least part of the memory leak.  Note that upstream harfbuzz seems to have changed significantly so can't apply it there.
Comment 2 Behdad Esfahbod 2012-06-14 00:50:02 UTC
Ah.  Thanks.  I just checked and upstream looks fine.  Fixed it recently in fact.

Can you commit please?
Comment 3 Robert Ancell 2012-06-14 01:22:31 UTC
Pushed now, thanks Behdad.
Comment 4 Behdad Esfahbod 2012-06-14 01:25:48 UTC
Thank *you* Robert.