[Wayland-bugs] [Bug 775126] memory leak in gdk_wayland_window_ensure_cairo_surface

gtk+ (GNOME Bugzilla) bugzilla at gnome.org
Fri Sep 22 08:22:00 UTC 2017


https://bugzilla.gnome.org/show_bug.cgi?id=775126

Daniel Elstner <daniel.kitta at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kitta at gmail.com

--- Comment #2 from Daniel Elstner <daniel.kitta at gmail.com> ---
I see it in 3.22.21 in an application that uses OpenGL for an animation. The
thing is leaking like a sieve.

I investigated a bit, and this code in
gdk_wayland_window_ensure_cairo_surface() looks kinda fishy to me:

  /* If we are drawing using OpenGL then we only need a logical 1x1 surface. */
  if (impl->display_server.egl_window)
    {
      if (impl->staging_cairo_surface &&
          _gdk_wayland_is_shm_surface (impl->staging_cairo_surface))
        cairo_surface_destroy (impl->staging_cairo_surface);

      impl->staging_cairo_surface = cairo_image_surface_create
(CAIRO_FORMAT_ARGB32,
                                                                impl->scale,
                                                                impl->scale);
      cairo_surface_set_device_scale (impl->staging_cairo_surface,
                                      impl->scale, impl->scale);
    }
  else if (!impl->staging_cairo_surface)

Note how cairo_surface_destroy() is only called if
_gdk_wayland_is_shm_surface() is TRUE, but the 1x1 dummy surface is recreated
in every single drawing call.

As I said, the thing really does leak like a sieve. Several megabytes per
minute, so it's pretty serious. I suspect that using GL is a precondition for
reproducing this with GTK+ 3.22.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-bugs/attachments/20170922/8ae3db9c/attachment.html>


More information about the wayland-bugs mailing list