[Spice-devel] [PATCH] egl: fix leak when display is unrealize

Marc-André Lureau mlureau at redhat.com
Tue Mar 29 13:55:53 UTC 2016


ack (that makes me wonder if we should have a global EGLDisplay instead of each widget).

----- Original Message -----
> eglTerminate should be called on unrealize. This not yet fix all the
> leaks but reduces it significantly from 318kb to 74kb as definitely lost
> and around 1mb to 8kb as indirectly lost.
> 
> 4,096 bytes in 1 blocks are definitely lost in loss record
> 9,762 of 9,882
>    at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454)
>    by 0x35688320: can_write_oacontrol (intel_extensions.c:121)
>    by 0x35688320: intelInitExtensions (intel_extensions.c:279)
>    by 0x35651380: brwCreateContext (brw_context.c:875)
>    by 0x35602720: driCreateContextAttribs (dri_util.c:426)
>    by 0xF0C48B1: dri2_create_context (egl_dri2.c:1072)
>    by 0xF0BE727: eglCreateContext (eglapi.c:638)
>    by 0x5461D27: spice_egl_init (spice-widget-egl.c:256)
>    by 0x545B885: drawing_area_realize (spice-widget.c:581)
>    by 0xB431784: g_closure_invoke (gclosure.c:804)
>    by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629)
>    by 0xB44C92E: g_signal_emit_valist (gsignal.c:3385)
>    by 0xB44CC51: g_signal_emit (gsignal.c:3441)
> 
> 4,856 (32 direct, 4,824 indirect) bytes in 1 blocks are definitely lost
> in loss record 9,779 of 9,882
>    at 0x4C2A988: calloc (vg_replace_malloc.c:711)
>    by 0xF0BEEF7: _eglCreateArray (eglarray.c:71)
>    by 0xF0BF420: _eglLinkConfig (eglconfig.c:90)
>    by 0xF0C4F8D: dri2_add_config (egl_dri2.c:307)
>    by 0xF0C66EE: dri2_x11_add_configs_for_visuals (platform_x11.c:766)
>    by 0xF0C80EC: dri2_initialize_x11_dri3 (platform_x11.c:1319)
>    by 0xF0C80EC: dri2_initialize_x11 (platform_x11.c:1464)
>    by 0xF0C18FE: _eglMatchAndInitialize (egldriver.c:261)
>    by 0xF0C19B8: _eglMatchDriver (egldriver.c:292)
>    by 0xF0BDD31: eglInitialize (eglapi.c:482)
>    by 0x5461A76: spice_egl_init (spice-widget-egl.c:226)
>    by 0x545B885: drawing_area_realize (spice-widget.c:581)
>    by 0xB431784: g_closure_invoke (gclosure.c:804)
> 
> 5,921 (472 direct, 5,449 indirect) bytes in 1 blocks are definitely lost
> in loss record 9,794 of 9,882
>    at 0x4C2A988: calloc (vg_replace_malloc.c:711)
>    by 0xF0C7E0E: dri2_initialize_x11_dri3 (platform_x11.c:1267)
>    by 0xF0C7E0E: dri2_initialize_x11 (platform_x11.c:1464)
>    by 0xF0C18FE: _eglMatchAndInitialize (egldriver.c:261)
>    by 0xF0C19B8: _eglMatchDriver (egldriver.c:292)
>    by 0xF0BDD31: eglInitialize (eglapi.c:482)
>    by 0x5461A76: spice_egl_init (spice-widget-egl.c:226)
>    by 0x545B885: drawing_area_realize (spice-widget.c:581)
>    by 0xB431784: g_closure_invoke (gclosure.c:804)
>    by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629)
>    by 0xB44C92E: g_signal_emit_valist (gsignal.c:3385)
>    by 0xB44CC51: g_signal_emit (gsignal.c:3441)
>    by 0x5D2C9DB: gtk_widget_realize (gtkwidget.c:5454)
> 
> 16,384 bytes in 4 blocks are definitely lost in loss record 9,854 of 9,882
>    at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454)
>    by 0x3568AB30: intel_miptree_map_raw (intel_mipmap_tree.c:2149)
>    by 0x3568CEE6: intel_miptree_map_gtt (intel_mipmap_tree.c:2182)
>    by 0x3568CEE6: intel_miptree_map (intel_mipmap_tree.c:2774)
>    by 0x35692851: intel_map_texture_image (intel_tex.c:227)
>    by 0x35447C3B: store_texsubimage (texstore.c:1069)
>    by 0x35447E9F: _mesa_store_teximage (texstore.c:1125)
>    by 0x3543D9BA: _mesa_get_fallback_texture (texobj.c:1056)
>    by 0x35443E1E: UnknownInlinedFun (texstate.c:562)
>    by 0x35443E1E: update_program_texture_state (texstate.c:587)
>    by 0x35443E1E: UnknownInlinedFun (texstate.c:726)
>    by 0x35443E1E: _mesa_update_texture (texstate.c:757)
>    by 0x35420809: _mesa_update_state_locked (state.c:430)
>    by 0x35420ED0: _mesa_update_state (state.c:504)
>    by 0x3535BF87: _mesa_Clear (clear.c:172)
>    by 0x546214F: spice_egl_update_display (spice-widget-egl.c:514)
> 
> 32,768 bytes in 1 blocks are definitely lost in loss record 9,864 of 9,882
>    at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454)
>    by 0x35683E3C: intel_batchbuffer_reset (intel_batchbuffer.c:68)
>    by 0x35684052: brw_new_batch (intel_batchbuffer.c:164)
>    by 0x35684052: _intel_batchbuffer_flush.part.2 (intel_batchbuffer.c:397)
>    by 0x3568853B: can_write_oacontrol (intel_extensions.c:153)
>    by 0x3568853B: intelInitExtensions (intel_extensions.c:279)
>    by 0x35651380: brwCreateContext (brw_context.c:875)
>    by 0x35602720: driCreateContextAttribs (dri_util.c:426)
>    by 0xF0C48B1: dri2_create_context (egl_dri2.c:1072)
>    by 0xF0BE727: eglCreateContext (eglapi.c:638)
>    by 0x5461D27: spice_egl_init (spice-widget-egl.c:256)
>    by 0x545B885: drawing_area_realize (spice-widget.c:581)
>    by 0xB431784: g_closure_invoke (gclosure.c:804)
>    by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629)
> 
> 32,768 bytes in 1 blocks are definitely lost in loss record 9,865 of 9,882
>    at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454)
>    by 0x35683E3C: intel_batchbuffer_reset (intel_batchbuffer.c:68)
>    by 0x35684052: brw_new_batch (intel_batchbuffer.c:164)
>    by 0x35684052: _intel_batchbuffer_flush.part.2 (intel_batchbuffer.c:397)
>    by 0x356887F3: can_do_pipelined_register_writes (intel_extensions.c:88)
>    by 0x356887F3: intelInitExtensions (intel_extensions.c:338)
>    by 0x35651380: brwCreateContext (brw_context.c:875)
>    by 0x35602720: driCreateContextAttribs (dri_util.c:426)
>    by 0xF0C48B1: dri2_create_context (egl_dri2.c:1072)
>    by 0xF0BE727: eglCreateContext (eglapi.c:638)
>    by 0x5461D27: spice_egl_init (spice-widget-egl.c:256)
>    by 0x545B885: drawing_area_realize (spice-widget.c:581)
>    by 0xB431784: g_closure_invoke (gclosure.c:804)
>    by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629)
> 
> 98,304 bytes in 3 blocks are definitely lost in loss record 9,872 of 9,882
>    at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454)
>    by 0x35683E3C: intel_batchbuffer_reset (intel_batchbuffer.c:68)
>    by 0x35684052: brw_new_batch (intel_batchbuffer.c:164)
>    by 0x35684052: _intel_batchbuffer_flush.part.2 (intel_batchbuffer.c:397)
>    by 0x3564F834: intel_glFlush (brw_context.c:259)
>    by 0xF0C3DA0: dri2_make_current (egl_dri2.c:1189)
>    by 0xF0BAB1B: eglMakeCurrent (eglapi.c:703)
>    by 0x546274E: spice_widget_init_egl_win (spice-widget-egl.c:316)
>    by 0x546274E: spice_egl_realize_display (spice-widget-egl.c:333)
>    by 0x545B89F: drawing_area_realize (spice-widget.c:586)
>    by 0xB431784: g_closure_invoke (gclosure.c:804)
>    by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629)
>    by 0xB44C92E: g_signal_emit_valist (gsignal.c:3385)
>    by 0xB44CC51: g_signal_emit (gsignal.c:3441)
> 
> 131,072 bytes in 4 blocks are definitely lost in loss record 9,874 of 9,882
>    at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454)
>    by 0x35683E3C: intel_batchbuffer_reset (intel_batchbuffer.c:68)
>    by 0x356848E8: intel_batchbuffer_init (intel_batchbuffer.c:45)
>    by 0x35651337: brwCreateContext (brw_context.c:848)
>    by 0x35602720: driCreateContextAttribs (dri_util.c:426)
>    by 0xF0C48B1: dri2_create_context (egl_dri2.c:1072)
>    by 0xF0BE727: eglCreateContext (eglapi.c:638)
>    by 0x5461D27: spice_egl_init (spice-widget-egl.c:256)
>    by 0x545B885: drawing_area_realize (spice-widget.c:581)
>    by 0xB431784: g_closure_invoke (gclosure.c:804)
>    by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629)
>    by 0xB44C92E: g_signal_emit_valist (gsignal.c:3385)
> 
> 1,080,655 (284 direct, 1,080,371 indirect) bytes in 1 blocks are
> definitely lost in loss record 9,881 of 9,882
>    at 0x4C2A988: calloc (vg_replace_malloc.c:711)
>    by 0x355A2221: ralloc_size (ralloc.c:113)
>    by 0x355A227D: rzalloc_size (ralloc.c:134)
>    by 0x355A2BEE: ra_alloc_reg_set (register_allocate.c:196)
>    by 0x356D79AA: brw_alloc_reg_set(brw_compiler*, int)
>    (brw_fs_reg_allocate.cpp:159)
>    by 0x356D817D: brw_fs_alloc_reg_sets (brw_fs_reg_allocate.cpp:305)
>    by 0x356FDACC: brw_compiler_create (brw_shader.cpp:84)
>    by 0x35691995: intelInitScreen2 (intel_screen.c:1495)
>    by 0x35602A5E: driCreateNewScreen2 (dri_util.c:144)
>    by 0xF0C547B: dri2_create_screen (egl_dri2.c:674)
>    by 0xF0C808F: dri2_initialize_x11_dri3 (platform_x11.c:1303)
>    by 0xF0C808F: dri2_initialize_x11 (platform_x11.c:1464)
>    by 0xF0C18FE: _eglMatchAndInitialize (egldriver.c:261)
> ---
>  src/spice-widget-egl.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> index 126269f..51bb5c5 100644
> --- a/src/spice-widget-egl.c
> +++ b/src/spice-widget-egl.c
> @@ -382,6 +382,7 @@ void spice_egl_unrealize_display(SpiceDisplay *display)
>  
>      eglMakeCurrent(d->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE,
>                     EGL_NO_CONTEXT);
> +    eglTerminate(d->egl.display);
>  }
>  
>  G_GNUC_INTERNAL
> --
> 2.5.5
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list