[Spice-devel] [bug spice-gtk] spice-gtk memory leak

徐舫 xufango at gmail.com
Fri Mar 16 09:13:20 PDT 2012


**
Thank you very much.

1) I used Inspector XE 2011 on RHEL6.1 analysis the memory leak problem.
    Inspector XE 2011 can give the leak location but no call stack.

2) I used most of the spice-gtk code except the spicy.c, and modify no code
below the spice-widget.c.
    Successfully compiled the code using MingW gcc on Windows.
    Then I use C++ memory leak detector(
http://www.softwareverify.com/cpp-memory.php).
    Finally I get the memory leak call stack.
    I also use C++ memory leak detector analysis spicec, spices has less
memory leak as you said.

I will continue to spend time on tracing and analysis the image cache
mechanism.

But as far as I known, as one image has been created, there is on place to
reference the allocated image.

So :

"""
src_image = canvas_get_image(canvas, copy->src_bitmap, FALSE);

pixman_image_unref(src_image);
"""
pixman_image_unref will free the image and associated image data.

Am I right?

------------------------------
xufango

 *From:* Marc-André Lureau <marcandre.lureau at gmail.com>
*Date:* 2012-03-16 23:24
*To:* 徐舫 <xufango at gmail.com>
*CC:* spice-devel <spice-devel at lists.freedesktop.org>
*Subject:* Re: [Spice-devel] [bug spice-gtk] spice-gtk memory leak
 On Fri, Mar 16, 2012 at 10:27 AM, 徐舫 <xufango at gmail.com> wrote:
> But the allocated memory does not free.

According to massif, the memory usage becomes stable, but your
backtrace is correct, the biggest offender is image cache, which can
top 150mb. I am not very familiar with the caching logic, so I can't
say whether this can be tuned to limit to a given amount. It could
also be that spice-gtk cache is buggy, because spicec seems to use a
little bit less (50mb). But I do tests manually, so my empirical
results may vary.

Also, running spicy under valgrind leak check tool shows quite clearly
that there is nothing being leaked directly from spice-gtk, it seems.

regards

-- 
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20120317/ae5a4802/attachment.html>


More information about the Spice-devel mailing list