[Spice-devel] spice-gtk / remote viewer leaks (gobs of) memory - possibly related to animated mouse cursor?
Marc-André Lureau
mlureau at redhat.com
Tue May 6 08:05:16 PDT 2014
Hi
----- Original Message -----
>
> On 05/06/2014 09:49 AM, David Mansfield wrote:
> >
> > On 05/06/2014 06:04 AM, Marc-André Lureau wrote:
> >> Hi
> >>
> >> ----- Original Message -----
> >>> On 05/05/2014 04:10 PM, Marc-André Lureau wrote:
> >>>> Hi
> >>>>
> >>>> ----- Original Message -----
> >>>>> Any way to easily trace memory leaks in remote-viewer? A naive
> >>>>> attempt
> >>>>> at "valgrind remote-viewer spice://blah" didn't turn up anything in
> >>>>> particular.
> >>>> Have you tried with massif? It usually gives pretty good hints.
> >>> Here is "ms_print" output. I've never used massif before, is this
> >>> helpful?
> >> This massif profile doesn't show a large memory usage or any obvious
> >> leak.
> >>
> >> Are you looking at virtual or resident (RSS) memory usage? (remember
> >> that
> >> only RSS really "count")
> > Yes, RSS goes over 2GB easily with 8 hours of usage.
> >
> > I have changed spice-widget.c as follows:
> >
> > @@ -2205,14 +2210,15 @@
> > (GdkPixbufDestroyNotify)g_free, NULL);
> > d->mouse_hotspot.x = hot_x;
> > d->mouse_hotspot.y = hot_y;
> > - cursor =
> > gdk_cursor_new_from_pixbuf(gtk_widget_get_display(GTK_WIDGET(display)),
> > - d->mouse_pixbuf, hot_x,
> > hot_y);
> > + cursor =
> > gdk_cursor_new_for_display(gtk_widget_get_display(GTK_WIDGET(display)),
> > GDK_FLEUR);
> >
> > + //cursor =
> > gdk_cursor_new_from_pixbuf(gtk_widget_get_display(GTK_WIDGET(display)),
> > + // d->mouse_pixbuf, hot_x,
> > hot_y);
> > } else
> > g_warn_if_reached();
> >
> >
> > And, while it's true I only get a hand cursor no matter what, there is
> > no leak. I can wiggle the mouse to my heart's content and the RSS
> > stays flat (after initially increasing to fill the local tile cache).
> > There is 100% no doubt in my mind that there is a leak here. Although
> > the code looks correct to me.
> >
> > I also tried changing gdk_cursor_unref to g_object_unref but it made
> > no difference.
>
> I'm certainly not familiar with gtk3/gdk internals, but it seems like
> gdk/gdkcursor.c (in function gdk_cursor_new_from_pixbuf, line 385 in
> F20) allocates a "cairo surface" for each cursor that is created from
> pixbuf that is leaked.
>
> Any gdk gurus on the list to check this?
I come to the same conclusion as you, it seems cairo will add a ref to the surface in
_gdk_x11_display_get_cursor_for_surface
create_cursor_image
cairo_set_source_surface (cr, source_surface, 0, 0);
So a cairo_surface_destroy() seems to be missing there. Could you try with that?
Funny that we don't see that leak in your massif profile.
More information about the Spice-devel
mailing list