From patchwork Thu Aug 26 18:38:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3/5] HACKING: add memory management rules Date: Thu, 26 Aug 2010 08:38:40 -0000 From: Blue Swirl X-Patchwork-Id: 62799 Message-Id: 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(-) +emulators. diff --git a/HACKING b/HACKING index 19fc874..554009e 100644 --- a/HACKING +++ b/HACKING @@ -72,3 +72,14 @@ Typedefs are used to eliminate the redundant 'struct' keyword. 2.4. Reserved namespaces in C Underscore capital, double underscore, and underscore 't' suffixes should be avoided. + +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