Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-111576

Wayland client leaks memory

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.8.0 FF
    • 6.5.0 Beta3
    • QPA: Wayland
    • None
    • 5085fa082 (dev)

    Description

      I generally run my tests through ASAN and it always reports the following:

      ==42701==ERROR: LeakSanitizer: detected memory leaks
      
      Direct leak of 960 byte(s) in 12 object(s) allocated from:
          #0 0x7efc281c4037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
          #1 0x7efc1a46bee9 in zalloc ../src/wayland-private.h:232
          #2 0x7efc1a46bee9 in proxy_create ../src/wayland-client.c:422
          #3 0x7efc1a46bee9 in create_outgoing_proxy ../src/wayland-client.c:651
          #4 0x7efc1a46bee9 in wl_proxy_marshal_array_constructor_versioned ../src/wayland-client.c:736
      
      SUMMARY: AddressSanitizer: 960 byte(s) leaked in 12 allocation(s).
      

      Discussion in https://codereview.qt-project.org/c/qt/qtwayland/+/397325 revealed that:

      It's a whole bunch of globals:

      ==217091== by 0xBAF64B7: QtWayland::wl_subcompositor::init(wl_registry*, int, int) (qwayland-wayland.cpp:2368)

      ==217091== by 0xBAF33C0: QtWayland::zxdg_output_manager_v1::zxdg_output_manager_v1(wl_registry*, int, int) (qwayland-xdg-output-unstable-v1.cpp:26)

      ==217091== by 0xBAF0C31: QtWayland::zwp_primary_selection_device_manager_v1::init(wl_registry*, int, int) (qwayland-wp-primary-selection-unstable-v1.cpp:45)

      ==217091== by 0xBAF5D6F: QtWayland::wl_seat::init(wl_registry*, int, int) (qwayland-wayland.cpp:1440)

      ==217091== by 0xBAF47EF: QtWayland::wl_shm::init(wl_registry*, int, int) (qwayland-wayland.cpp:343)

      ==217091== by 0xBAF1A8B: QtWayland::zwp_tablet_manager_v2::init(wl_registry*, int, int) (qwayland-tablet-unstable-v2.cpp:45)

      ==217091== by 0xBAF44B7: QtWayland::wl_compositor::init(wl_registry*, int, int) (qwayland-wayland.cpp:217)

      QtWayland::zwp_text_input_manager_v2::init

      QtWayland::wl_output::wl_output (from the screen constructor)

      wl_display_get_registry itself.

      Some will have proper destructors, some of those will need version guards, others we will have to cast and do wl_proxy_destroy(static_cast<>(object()));

      Being not very familiar with the wayland internals I'm having a hard time fixing this, but the constant noise makes it harder to work with my tests.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            davidedmundson David Edmundson
            ulherman Ulf Hermann
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes