From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCVkW-0000cQ-LB for qemu-devel@nongnu.org; Wed, 30 Jul 2014 11:25:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCVkM-00041C-R3 for qemu-devel@nongnu.org; Wed, 30 Jul 2014 11:25:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52559) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCVkM-00040a-HK for qemu-devel@nongnu.org; Wed, 30 Jul 2014 11:24:54 -0400 Date: Wed, 30 Jul 2014 16:24:50 +0100 From: Stefan Hajnoczi Message-ID: <20140730152450.GJ597@stefanha-thinkpad.redhat.com> References: <1406670884-29450-1-git-send-email-jsnow@redhat.com> <1406670884-29450-4-git-send-email-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k1BdFSKqAqVdu8k/" Content-Disposition: inline In-Reply-To: <1406670884-29450-4-git-send-email-jsnow@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/4] libqos: add a simple first-fit memory allocator List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: marc.mari.barcelo@gmail.com, pbonzini@redhat.com, qemu-devel@nongnu.org --k1BdFSKqAqVdu8k/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 29, 2014 at 05:54:43PM -0400, John Snow wrote: > diff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c > index 2efd095..410181d 100644 > --- a/tests/libqos/malloc-pc.c > +++ b/tests/libqos/malloc-pc.c > @@ -21,41 +21,336 @@ > =20 > #define PAGE_SIZE (4096) > =20 > +typedef struct mem_block { QEMU generally uses CamelCase for struct tags too. The name can be the same as the typedef (MemBlock). > + struct mem_block *prev; > + struct mem_block *next; Please see include/qemu/queue.h for variants of linked lists. QTAILQ should work, then you can drop your custom doubly-linked list code. > + fprintf(stderr, "guest malloc leak @ 0x%016lx size 0x%016lx\= n", > + node->addr, node->size); On 32-bit hosts %lx is 32-bit but addr is uint64_t. Please use the PRIx64 macro here and for other instances in this patch. --k1BdFSKqAqVdu8k/ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJT2Q5CAAoJEJykq7OBq3PI4nMIALAAzi7ob5IPSC7xdCMAwHOv xlCkhVDX7pRpTHJVjPWNtU3mmuDwnFkuquCZVailZ51XfX1Iu1U+muovHm8jAB1M IJ+IYDfuJajFW1PrT6A/CNwXIyTE5OJVxCnZReD9m5D4NlN/2gRwOCGOWM5PfYk9 TSlkMaCHdoQXvC2lVPVWni6ZUa2QwJXrRSUNpRiJCf+rSQdp0AkI4m3qr0uzwRUb Zg49FzlDMYXwT8NtsQZLTu3x1DNEp9IVfsZKk2YOhomQjjv+McJ6B3V5hyu3X1yW Y3zaw5DswvMRtNeJ93DrFQxiqqRd9ZjSUYEcQDvC1fNPMY209uhfBBSdmyVo4XI= =13ZL -----END PGP SIGNATURE----- --k1BdFSKqAqVdu8k/--