From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zgva1-0005o6-DB for qemu-devel@nongnu.org; Tue, 29 Sep 2015 10:08:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgvZx-0006mK-K0 for qemu-devel@nongnu.org; Tue, 29 Sep 2015 10:08:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgvZx-0006m4-EZ for qemu-devel@nongnu.org; Tue, 29 Sep 2015 10:08:25 -0400 Message-ID: <1443535703.21557.63.camel@redhat.com> From: Gerd Hoffmann Date: Tue, 29 Sep 2015 16:08:23 +0200 In-Reply-To: References: <1443206217-6255-1-git-send-email-pl@kamp.de> <1443522513.21557.18.camel@redhat.com> <1443530995.21557.24.camel@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2] vnc: destroy server surface if no client is connected List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven Cc: qemu-devel@nongnu.org Hi, > what about Recycling the output buffer as worker thread buffer? You can't do that as vs is allocated on the stack, therefore not valid any more when vnc_worker_thread_loop returns. > about shrinking: I had the idea to count the number of times the buffer was (significantly) too big and only shrink if that counter has reached a reasonable value. and reset that counter to zero if the buffer has the right size. > > i would check this in qio_buffer_resize. as you suggested earlier. Not sure whenever it is a good idea to do that on every reserve call. Maybe better place shrink calls in places where you know it is worth checking, to have lower overhead. Patches are welcome in any case ;) cheers, Gerd