From patchwork Thu Aug 12 17:50:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3/5] CODING_STYLE: add memory management rules Date: Thu, 12 Aug 2010 07:50:17 -0000 From: Blue Swirl X-Patchwork-Id: 61636 Message-Id: To: qemu-devel Add memory management rules, somewhat like libvirt HACKING. Signed-off-by: Blue Swirl --- CODING_STYLE | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/CODING_STYLE b/CODING_STYLE index 3f10d72..085c86f 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -148,3 +148,11 @@ up-front that this is a read-only pointer. Perhaps more importantly, if we're diligent about this, when you see a non-const pointer, you're guaranteed that it is used to modify the storage it points to, or it is aliased to another pointer that is. + + +7. Low level memory management + +Use of the malloc/free/realloc/calloc 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.