From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56921 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Okjpu-0003xf-7L for qemu-devel@nongnu.org; Sun, 15 Aug 2010 16:29:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OkhMJ-0002T3-Gv for qemu-devel@nongnu.org; Sun, 15 Aug 2010 13:51:04 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:59017) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OkhMJ-0002Sw-Db for qemu-devel@nongnu.org; Sun, 15 Aug 2010 13:50:59 -0400 Received: by qwh5 with SMTP id 5so4618856qwh.4 for ; Sun, 15 Aug 2010 10:50:58 -0700 (PDT) MIME-Version: 1.0 From: Blue Swirl Date: Sun, 15 Aug 2010 17:50:37 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: [Qemu-devel] [PATCH 3/5] HACKING: add memory management rules List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Add memory management rules, somewhat like libvirt HACKING. Signed-off-by: Blue Swirl --- HACKING | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/HACKING b/HACKING index 7c6b49e..e0342df 100644 --- a/HACKING +++ b/HACKING @@ -68,3 +68,14 @@ it points to, or it is aliased to another pointer that is. 2.3. Typedefs Typedefs are used to eliminate the redundant 'struct' keyword. + +3. Low level memory management + +Use of the malloc/free/realloc/calloc/valloc/memalign/posix_memalign +APIs is not allowed in the QEMU codebase. Instead of these routines, +use the replacement qemu_malloc/qemu_mallocz/qemu_realloc/qemu_free or +qemu_vmalloc/qemu_memalign/qemu_vfree APIs. + +Memory allocated by qemu_vmalloc or qemu_memalign must be freed with +qemu_vfree, since breaking this will cause problems on Win32 and user +emulators. -- 1.6.2.4