Patchwork [3/5] HACKING: add memory management rules

mail settings
Submitter Blue Swirl
Date Aug. 15, 2010, 5:50 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/61776/
State New
Headers show


Blue Swirl - Aug. 15, 2010, 5:50 p.m.
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
@@ -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