Skip to content

Wayland leak fixes

Sebastian Keller requested to merge skeller/mutter:wayland-leaks into master
==9186== 64 bytes in 2 blocks are definitely lost in loss record 15,676 of 28,408
==9186==    at 0x483BD19: realloc (vg_replace_malloc.c:836)
==9186==    by 0x4D25397: g_realloc (gmem.c:167)
==9186==    by 0x4CEEB0B: g_array_maybe_expand (garray.c:962)
==9186==    by 0x4CEEF59: g_array_append_vals (garray.c:479)
==9186==    by 0x5914AF2: meta_wayland_surface_assign_role (meta-wayland-surface.c:199)
==9186==    by 0x59215F0: xdg_surface_constructor_get_toplevel (meta-wayland-xdg-shell.c:1699)
==9186==    by 0x66D5AA7: ffi_call_unix64 (in /usr/lib64/libffi.so.6.0.2)
==9186==    by 0x66D52A3: ffi_call (in /usr/lib64/libffi.so.6.0.2)
==9186==    by 0x5FAC594: wl_closure_invoke (connection.c:1018)
==9186==    by 0x5FA6318: wl_client_connection_data (wayland-server.c:432)
==9186==    by 0x5FA970F: wl_event_source_fd_dispatch (event-loop.c:95)
==9186==    by 0x5FAA0CB: wl_event_loop_dispatch (event-loop.c:641)
==9186== 3,108 bytes in 111 blocks are definitely lost in loss record 27,352 of 28,408
==9186==    at 0x483BB1A: calloc (vg_replace_malloc.c:762)
==9186==    by 0x4D25338: g_malloc0 (gmem.c:132)
==9186==    by 0x591D93F: meta_wayland_window_configuration_new (meta-wayland-window-configuration.c:35)
==9186==    by 0x5922454: meta_window_wayland_configure (meta-window-wayland.c:175)
==9186==    by 0x59232CF: meta_window_wayland_move_resize_internal (meta-window-wayland.c:326)
==9186==    by 0x58CB336: meta_window_move_resize_internal (window.c:4086)
==9186==    by 0x58CC1BC: meta_window_resize_frame_with_gravity (window.c:4335)
==9186==    by 0x58CDD65: update_resize (window.c:6349)
==9186==    by 0x58D0865: meta_window_handle_mouse_grab_op_event (window.c:6490)
==9186==    by 0x58AFB9A: meta_display_handle_event (events.c:344)
==9186==    by 0x58AFB9A: event_callback (events.c:479)
==9186==    by 0x56EA10D: _clutter_event_process_filters (clutter-event.c:1922)
==9186==    by 0x5702A81: emit_pointer_event (clutter-main.c:1585)
==9186==    by 0x5702A81: _clutter_process_event_details (clutter-main.c:1980)
==9186==    by 0x5702A81: _clutter_process_event (clutter-main.c:2156)

Added a few more:

This one seems like it could have quite some impact for night light users. There were 3 of these from just toggling it on and off again:

==9623== 28,672 bytes in 56 blocks are definitely lost in loss record 27,148 of 27,295
==9623==    at 0x483980B: malloc (vg_replace_malloc.c:309)
==9623==    by 0x4D252D0: g_malloc (gmem.c:102)
==9623==    by 0x4D3F2DE: g_memdup (gstrfuncs.c:391)
==9623==    by 0x593C593: meta_kms_crtc_predict_state (meta-kms-crtc.c:212)
==9623==    by 0x4D1B28F: g_list_foreach (glist.c:1069)
==9623==    by 0x593D27F: meta_kms_impl_device_predict_states (meta-kms-impl-device.c:343)
==9623==    by 0x4D1B28F: g_list_foreach (glist.c:1069)
==9623==    by 0x59406A2: meta_kms_predict_states_in_impl (meta-kms.c:199)
==9623==    by 0x59406A2: meta_kms_update_process_in_impl (meta-kms.c:214)
==9623==    by 0x59406A2: meta_kms_run_impl_task_sync (meta-kms.c:343)
==9623==    by 0x59406A2: meta_kms_post_update_sync (meta-kms.c:229)
==9623==    by 0x59406A2: meta_kms_post_pending_update_sync (meta-kms.c:239)
==9623==    by 0x5934FD2: meta_monitor_manager_kms_set_crtc_gamma (meta-monitor-manager-kms.c:469)
==9623==    by 0x587702D: meta_monitor_manager_handle_set_crtc_gamma (meta-monitor-manager.c:2264)
==9623==    by 0x587702D: meta_monitor_manager_handle_set_crtc_gamma (meta-monitor-manager.c:2213)
==9623==    by 0x66D5AA7: ffi_call_unix64 (in /usr/lib64/libffi.so.6.0.2)
==9623==    by 0x66D52A3: ffi_call (in /usr/lib64/libffi.so.6.0.2)

A small leak during initialization from set_gnome_env():

==20554== 144 bytes in 3 blocks are definitely lost in loss record 23,280 of 29,192
==20554==    at 0x483980B: malloc (vg_replace_malloc.c:309)
==20554==    by 0x4D252D0: g_malloc (gmem.c:102)
==20554==    by 0x4D3D414: g_slice_alloc (gslice.c:1024)
==20554==    by 0x4D5E1BC: g_variant_alloc (gvariant-core.c:486)
==20554==    by 0x4D5E4D5: g_variant_new_from_children (gvariant-core.c:624)
==20554==    by 0x4D5B087: g_variant_builder_end (gvariant.c:3714)
==20554==    by 0x4D5C7D1: g_variant_valist_new (gvariant.c:5224)
==20554==    by 0x4D5CC00: g_variant_new_va (gvariant.c:5397)
==20554==    by 0x4D5CD3D: g_variant_new (gvariant.c:5332)
==20554==    by 0x4BABC2D: decode_method_reply (gdbusconnection.c:5639)
==20554==    by 0x4BABC2D: decode_method_reply (gdbusconnection.c:5624)
==20554==    by 0x4BB174F: g_dbus_connection_call_sync_internal (gdbusconnection.c:6017)
==20554==    by 0x4BB37B1: g_dbus_connection_call_sync (gdbusconnection.c:6209)

This one affects X11 as well as wayland, but it's also very small:

==14419== 825 bytes in 25 blocks are definitely lost in loss record 25,422 of 27,604
==14419==    at 0x483980B: malloc (vg_replace_malloc.c:309)
==14419==    by 0x4D252D0: g_malloc (gmem.c:102)
==14419==    by 0x4D3F31A: g_strndup (gstrfuncs.c:425)
==14419==    by 0x592FA48: create_mode (meta-gpu-kms.c:346)
==14419==    by 0x592FD4A: init_modes (meta-gpu-kms.c:453)
==14419==    by 0x592FD4A: meta_gpu_kms_read_current (meta-gpu-kms.c:567)
==14419==    by 0x593058D: meta_gpu_kms_new (meta-gpu-kms.c:609)
==14419==    by 0x5928521: init_gpus (meta-backend-native.c:625)
==14419==    by 0x5928521: meta_backend_native_initable_init (meta-backend-native.c:678)
==14419==    by 0x58631FB: meta_init_backend (meta-backend.c:1351)
==14419==    by 0x58B5FA9: meta_init (main.c:599)
==14419==    by 0x402540: main (main.c:515)

And another tiny one.

==13703== 20 bytes in 1 blocks are definitely lost in loss record 5,553 of 27,988
==13703==    at 0x483BB1A: calloc (vg_replace_malloc.c:762)
==13703==    by 0x890CF5B: drmModeGetEncoder (in /usr/lib64/libdrm.so.2.4.0)
==13703==    by 0x593B51E: state_set_crtc_state (meta-kms-connector.c:410)
==13703==    by 0x593B51E: meta_kms_connector_read_state (meta-kms-connector.c:477)
==13703==    by 0x593B51E: meta_kms_connector_read_state (meta-kms-connector.c:452)
==13703==    by 0x593BE1C: meta_kms_connector_new (meta-kms-connector.c:621)
==13703==    by 0x593CD95: update_connectors (meta-kms-impl-device.c:237)
==13703==    by 0x593D3ED: meta_kms_impl_device_new (meta-kms-impl-device.c:388)
==13703==    by 0x593C68A: create_impl_device_in_impl (meta-kms-device.c:207)
==13703==    by 0x5940779: meta_kms_run_impl_task_sync (meta-kms.c:343)
==13703==    by 0x593CB54: meta_kms_device_new (meta-kms-device.c:243)
==13703==    by 0x594091E: meta_kms_create_device (meta-kms.c:540)
==13703==    by 0x592766A: create_gpu_from_udev_device (meta-backend-native.c:544)
==13703==    by 0x5928531: init_gpus (meta-backend-native.c:625)
==13703==    by 0x5928531: meta_backend_native_initable_init (meta-backend-native.c:678)
Edited by Sebastian Keller

Merge request reports