From: Philippe Waroquiers Date: Wed, 8 Feb 2012 22:23:55 +0000 (+0000) Subject: mc_main.c statistics has hard-coded logic to compute X-Git-Tag: svn/VALGRIND_3_8_0~484 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b191da4da785bfac215382beccc01e1094af1824;p=thirdparty%2Fvalgrind.git mc_main.c statistics has hard-coded logic to compute the memory used by sec vbit table. This logic depends on the way sec Vbit entries are maintained. Due to the introduction of pool alloc, this logic has to be changed to (more) correctly compute the memory. Verified on f12/x86 by comparing the memory reported by the memcheck stats with what is given by --profile-heap=yes. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12369 --- diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index fcbfe35227..ecabab3cef 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -6122,10 +6122,13 @@ static void mc_fini ( Int exitcode ) // Three DSMs, plus the non-DSM ones max_SMs_szB = (3 + max_non_DSM_SMs) * sizeof(SecMap); // The 3*sizeof(Word) bytes is the AVL node metadata size. - // The 4*sizeof(Word) bytes is the malloc metadata size. - // Hardwiring these sizes in sucks, but I don't see how else to do it. + // The VG_ROUNDUP is because the OSet pool allocator will/must align + // the elements on pointer size. + // Note that the pool allocator has some additional small overhead + // which is not counted in the below. + // Hardwiring this logic sucks, but I don't see how else to do it. max_secVBit_szB = max_secVBit_nodes * - (sizeof(SecVBitNode) + 3*sizeof(Word) + 4*sizeof(Word)); + (3*sizeof(Word) + VG_ROUNDUP(sizeof(SecVBitNode), sizeof(void*))); max_shmem_szB = sizeof(primary_map) + max_SMs_szB + max_secVBit_szB; VG_(message)(Vg_DebugMsg,