From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXx3b-00054N-Ta for qemu-devel@nongnu.org; Tue, 06 Dec 2011 10:35:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXx3T-000215-Vx for qemu-devel@nongnu.org; Tue, 06 Dec 2011 10:35:47 -0500 Received: from mail-ww0-f53.google.com ([74.125.82.53]:46713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXx3T-00020x-Ib for qemu-devel@nongnu.org; Tue, 06 Dec 2011 10:35:39 -0500 Received: by wgbds1 with SMTP id ds1so6498486wgb.10 for ; Tue, 06 Dec 2011 07:35:38 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <4EDDDB5A.8020102@linux.vnet.ibm.com> <4EDDE7E4.1020503@linux.vnet.ibm.com> Date: Tue, 6 Dec 2011 15:35:38 +0000 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] About the snapshot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhi Hui Li Cc: qemu-devel@nongnu.org 2011/12/6 Zhi Hui Li : > > > 2011/12/6 Stefan Hajnoczi >> >> On Tue, Dec 6, 2011 at 10:01 AM, Zhi Hui Li >> wrote: >> > On 2011=C4=EA12=D4=C206=C8=D5 17:40, Stefan Hajnoczi wrote: >> >> >> >> On Tue, Dec 6, 2011 at 9:07 AM, Zhi Hui Li >> >> wrote: >> >>> >> >>> >> >>> 1) : >> >>> >> >>> for example: >> >>> >> >>> BDRVQcowState *s =3D bs->opaque; >> >>> >> >>> s->snapshots >> >>> s->nb_snapshots >> >>> >> >>> >> >>> 1:use the command: qemu-img snapshot ./test.qcow2 -c aa >> >>> the memory of the s->snapshot don't free, >> >>> if the s->nb_snapshots is large, Does it have some problems. >> >>> >> >>> 2: use the command: qemu-system-x86_64 ./test.qcow2 -snapshot >> >>> when the program ends, Does it need to free the s->snapshots ? >> >> >> Okay, I think you're saying that in #1 s->snapshots is leaked because >> qcow2_free_snapshots() is not being called from qcow2_close(). >> >> Do you want to send a patch to fix this? > > > Ok, I will send a patch tomorrow. > But I think in the #2 it also need to call qcow2_free_snapshots() , if y= ou > have called several times savevm, > the s->snapshots will very large, when the process end, it also need to > free. Right, I think I understand what you're saying. I was thinking about what #1 and #2 mean differently, but it doesn't matter. If qcow2_close() frees s->snapshots then the problem is solved in all possible qcow2 use cases, including #2 with savevm. Stefan