summaryrefslogtreecommitdiffstats
path: root/HACKING
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2010-09-10 18:52:52 +0000
committerBlue Swirl <blauwirbel@gmail.com>2010-09-10 18:52:52 +0000
commit54b2cc50307097e903579a3fb61855c889c78ee9 (patch)
tree2eab555881f36bb77d42035f772c12d080c43d62 /HACKING
parent84174436a6cd948c3bac22bc02df5d2404ff641d (diff)
downloadhqemu-54b2cc50307097e903579a3fb61855c889c78ee9.zip
hqemu-54b2cc50307097e903579a3fb61855c889c78ee9.tar.gz
HACKING: add memory management rules
Add memory management rules, somewhat like libvirt HACKING. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'HACKING')
-rw-r--r--HACKING14
1 files changed, 14 insertions, 0 deletions
diff --git a/HACKING b/HACKING
index 0c8fad5..da0c1e8 100644
--- a/HACKING
+++ b/HACKING
@@ -72,3 +72,17 @@ Typedefs are used to eliminate the redundant 'struct' keyword.
2.4. Reserved namespaces in C and POSIX
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.
+
+Please note that NULL check for the qemu_malloc result is redundant and
+that qemu_malloc() call with zero size is not allowed.
+
+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.
OpenPOWER on IntegriCloud