Add info about overhead in heap blocks and OSet nodes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5361 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c
index d975f08..b2a1029 100644
--- a/coregrind/m_mallocfree.c
+++ b/coregrind/m_mallocfree.c
@@ -80,6 +80,15 @@
bszB == pszB + 2*sizeof(SizeT) + 2*a->rz_szB
+ The minimum overhead per heap block for arenas used by
+ the core is:
+
+ 32-bit platforms: 2*4 + 2*4 == 16 bytes
+ 64-bit platforms: 2*8 + 2*8 == 32 bytes
+
+ In both cases extra overhead may be incurred when rounding the payload
+ size up to VG_MIN_MALLOC_SZB.
+
Furthermore, both size fields in the block have their least-significant
bit set if the block is not in use, and unset if it is in use.
(The bottom 3 or so bits are always free for this because of alignment.)
diff --git a/coregrind/m_oset.c b/coregrind/m_oset.c
index 695d45d..0730ac6 100644
--- a/coregrind/m_oset.c
+++ b/coregrind/m_oset.c
@@ -42,7 +42,8 @@
// - First is the AVL metadata, which is three words: a left pointer, a
// right pointer, and a word containing balancing information and a
// "magic" value which provides some checking that the user has not
-// corrupted the metadata.
+// corrupted the metadata. So the overhead is 12 bytes on 32-bit
+// platforms and 24 bytes on 64-bit platforms.
// - Second is the user's data. This can be anything. Note that because it
// comes after the metadata, it will only be word-aligned, even if the
// user data is a struct that would normally be doubleword-aligned.