[Xcb] [Bug 105237] New: xcb_wait_for_reply makes valgrind report memory leaks on Mesa driver

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun Feb 25 08:28:56 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=105237

            Bug ID: 105237
           Summary: xcb_wait_for_reply makes valgrind report memory leaks
                    on Mesa driver
           Product: XCB
           Version: 1.11
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: NEW
          Severity: critical
          Priority: medium
         Component: Library
          Assignee: xcb at lists.freedesktop.org
          Reporter: 94389147 at qq.com
        QA Contact: xcb at lists.freedesktop.org

Hi all,
   I used valgrind to test my app's memory leak on ubuntu 16.04/amd64. In the
report, it gives me following callstacks about leaking.

==3307== 324 bytes in 9 blocks are definitely lost in loss record 704 of 901
==3307==    at 0x4C2DB8F: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==3307==    by 0xC23314B: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==3307==    by 0xC230ED0: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==3307==    by 0xC232616: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==3307==    by 0xC232720: xcb_wait_for_reply (in
/usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
==3307==    by 0xFFE21F1: dri3_update_drawable.isra.9
(loader_dri3_helper.c:1205)
==3307==    by 0xFFE361C: loader_dri3_get_buffers (loader_dri3_helper.c:1556)
==3307==    by 0x11CAC63C: intel_update_image_buffers (brw_context.c:1707)
==3307==    by 0x11CAC63C: intel_update_renderbuffers (brw_context.c:1383)
==3307==    by 0x11CACB10: intel_prepare_render (brw_context.c:1404)
==3307==    by 0x11CACBD2: intelMakeCurrent (brw_context.c:1242)
==3307==    by 0x11C6C9B5: driBindContext (dri_util.c:585)
==3307==    by 0xFFDDC95: dri3_bind_context (dri3_glx.c:199)

It seems the xcb_wait_for_reply calling caused the memory leak on my machine. I
delved into direct caller function in loader_dri3_helper.c:1205.
It's as following,

.....
1203       geom_cookie = xcb_get_geometry(draw->conn, draw->drawable);
1204 
1205       geom_reply = xcb_get_geometry_reply(draw->conn, geom_cookie, NULL);
1206 
1207       if (!geom_reply) {
1208          mtx_unlock(&draw->mtx);
1209          return false;
1210       }
1211 
1212       draw->width = geom_reply->width;
1213       draw->height = geom_reply->height;
1214       draw->depth = geom_reply->depth;
1215       draw->vtable->set_drawable_size(draw, draw->width, draw->height);
1216 
1217       free(geom_reply);
....

These is a free(geom_reply) to release resource in 1217 line. And I don't know
why valgrind doesn't count the free calling. It seems
xcb_get_geometry_reply/xcb_wait_for_reply not really reply and hanging there?

Jiancong

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/xcb/attachments/20180225/fefcde95/attachment.html>


More information about the Xcb mailing list