[Spice-devel] spice-gtk / remote viewer leaks (gobs of) memory - possibly related to animated mouse cursor?

David Mansfield spice at dm.cobite.com
Tue May 6 06:49:11 PDT 2014


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.

>
>> During this test, I have a desktop I've been logged into all day, but
>> for the test, I disconnected remote-viewer, ran remote-viewer with
>> massif and ran a "webdriver" test with google-chrome.  It hit a few
>> dozen pages with a few seconds wait time with each page.  I wiggled the
>> mouse cursor over the page as this happened.  Memory usage according to
>> 'ps' exceeded 1.2GB by the end of the test (with valgrind/massif
>> overhead, of course). Then I exited remote-viewer.
>>
>> Anything else you want?
>>
>> Thanks,
>> David
>>
>>
>> _______________________________________________
>> Spice-devel mailing list
>> Spice-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>>



More information about the Spice-devel mailing list