<html>
    <head>
      <base href="https://bugzilla.gnome.org/" />
    </head>
    <body><span class="vcard"><a href="page.cgi?id=describeuser.html&login=daniel.kitta%40gmail.com" title="Daniel Elstner <daniel.kitta@gmail.com>"> <span class="fn">Daniel Elstner</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - memory leak in gdk_wayland_window_ensure_cairo_surface"
   href="https://bugzilla.gnome.org/show_bug.cgi?id=775126">bug 775126</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>daniel.kitta@gmail.com
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - memory leak in gdk_wayland_window_ensure_cairo_surface"
   href="https://bugzilla.gnome.org/show_bug.cgi?id=775126#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - memory leak in gdk_wayland_window_ensure_cairo_surface"
   href="https://bugzilla.gnome.org/show_bug.cgi?id=775126">bug 775126</a>
              from <span class="vcard"><a href="page.cgi?id=describeuser.html&login=daniel.kitta%40gmail.com" title="Daniel Elstner <daniel.kitta@gmail.com>"> <span class="fn">Daniel Elstner</span></a>
</span></b>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>