Patchwork [FYI] memory leak in 0.14.0rc1 ?

login
register
mail settings
Submitter Bruce Rogers
Date Feb. 25, 2011, 7 p.m.
Message ID <4D6799E202000048000AA8EC@novprvoes0310.provo.novell.com>
Download mbox | patch
Permalink /patch/84563/
State New
Headers show

Comments

Bruce Rogers - Feb. 25, 2011, 7 p.m.
>>> On 2/25/2011 at 11:21 AM, Torsten Förtsch<torsten.foertsch@gmx.net> wrote: 
> On Tuesday, February 15, 2011 21:16:49 Stefan Hajnoczi wrote:
>> 2011/2/15 Torsten Förtsch <torsten.foertsch@gmx.net>:
>> > On Tuesday, February 15, 2011 15:43:32 Stefan Hajnoczi wrote:
>> >> > I have installed winxp and run the machine as "/usr/bin/qemu-kvm -name
>> >> > xp.home -m 768 ...".
>> >> 
>> >> Are you able to try QEMU 0.14.0-rc2 from source?
>> >> 
>> >> $ git clone git://git.qemu.org/qemu.git
>> >> $ git checkout v0.14.0-rc2
>> >> $ ./configure --target-list=x86_64-softmmu --enable-io-thread
>> >> --disable-strip --prefix=/usr
>> >> $ make
>> >> $ x86_64-softmmu/qemu-system-x86_64 -enable-kvm -m 768 -name xp.home ...
>> > 
>> > Now, the process size stays around 1300 Mb and RSS is very constant at
>> > 794 Mb.
>> 
>> Thank you for checking this.  This is probably a Suse-specific or
>> qemu-kvm issue.
> 
> Just for your information, it turns out that --enable-vnc-thread is the 
> culprit, see
> 
>   https://bugzilla.novell.com/show_bug.cgi?id=671809
> 
> The method explained there (comment 4) also makes a 0.14.0 compiled from the 
> 
> sources and configured as
> 
>   ./configure --target-list=x86_64-softmmu \
>               --enable-io-thread --enable-vnc-thread
> 
> grow.
> 
> Torsten Förtsch

I haven't played much in the vnc code, but the following patch at least gets rid of the leak.
I'm not sure if it's the "correct" solution. If someone more familiar with the vnc code wants
to look into this, that would be great:

 static void vnc_async_encoding_end(VncState *orig, VncState *local)
@@ -288,7 +286,6 @@ static void vnc_queue_clear(VncJobQueue *q)
 {
     qemu_cond_destroy(&queue->cond);
     qemu_mutex_destroy(&queue->mutex);
-    buffer_free(&queue->buffer);
     qemu_free(q);
     queue = NULL; /* Unset global queue */
 }


Bruce

Patch

diff --git a/ui/vnc-jobs-async.c b/ui/vnc-jobs-async.c
index 0b5d750..ebdba41 100644
--- a/ui/vnc-jobs-async.c
+++ b/ui/vnc-jobs-async.c
@@ -52,7 +52,6 @@  struct VncJobQueue {
     QemuCond cond;
     QemuMutex mutex;
     QemuThread thread;
-    Buffer buffer;
     bool exit;
     QTAILQ_HEAD(, VncJob) jobs;
 };
@@ -171,10 +170,9 @@  static void vnc_async_encoding_start(VncState *orig, VncSta
te *local)
     local->tight = orig->tight;
     local->zlib = orig->zlib;
     local->hextile = orig->hextile;
-    local->output =  queue->buffer;
     local->csock = -1; /* Don't do any network work on this thread */
 
-    buffer_reset(&local->output);
+    buffer_free(&local->output);
 }