|
From: <sv...@va...> - 2009-05-25 00:03:52
|
Author: njn
Date: 2009-05-25 01:03:48 +0100 (Mon, 25 May 2009)
New Revision: 10138
Log:
Merged r10136 (fix heap profiling) from the trunk.
Modified:
branches/DARWIN/coregrind/m_mallocfree.c
Modified: branches/DARWIN/coregrind/m_mallocfree.c
===================================================================
--- branches/DARWIN/coregrind/m_mallocfree.c 2009-05-24 23:43:30 UTC (rev 10137)
+++ branches/DARWIN/coregrind/m_mallocfree.c 2009-05-25 00:03:48 UTC (rev 10138)
@@ -70,7 +70,7 @@
/* Layout of an in-use block:
- cost center (OPTIONAL) (sizeof(ULong) bytes, only when h-p enabled)
+ cost center (OPTIONAL) (VG_MIN_MALLOC_SZB bytes, only when h-p enabled)
this block total szB (sizeof(SizeT) bytes)
red zone bytes (depends on Arena.rz_szB, but >= sizeof(void*))
(payload bytes)
@@ -79,7 +79,7 @@
Layout of a block on the free list:
- cost center (OPTIONAL) (sizeof(ULong) bytes, only when h-p enabled)
+ cost center (OPTIONAL) (VG_MIN_MALLOC_SZB bytes, only when h-p enabled)
this block total szB (sizeof(SizeT) bytes)
freelist previous ptr (sizeof(void*) bytes)
excess red zone bytes (if Arena.rz_szB > sizeof(void*))
@@ -95,7 +95,7 @@
when heap profiling is not enabled, and
- bszB == pszB + 2*sizeof(SizeT) + 2*a->rz_szB + sizeof(ULong)
+ bszB == pszB + 2*sizeof(SizeT) + 2*a->rz_szB + VG_MIN_MALLOC_SZB
when it is enabled. It follows that the minimum overhead per heap
block for arenas used by the core is:
@@ -105,8 +105,8 @@
when heap profiling is not enabled, and
- 32-bit platforms: 2*4 + 2*4 + 8 == 24 bytes
- 64-bit platforms: 2*8 + 2*8 + 8 == 40 bytes
+ 32-bit platforms: 2*4 + 2*4 + 8 == 24 bytes
+ 64-bit platforms: 2*8 + 2*8 + 16 == 48 bytes
when it is enabled. In all cases, extra overhead may be incurred
when rounding the payload size up to VG_MIN_MALLOC_SZB.
@@ -231,7 +231,7 @@
static __inline__
SizeT hp_overhead_szB ( void )
{
- return VG_(clo_profile_heap) ? sizeof(ULong) : 0;
+ return VG_(clo_profile_heap) ? VG_MIN_MALLOC_SZB : 0;
}
//---------------------------------------------------------------------------
@@ -472,9 +472,7 @@
// redzone size if necessary to achieve this.
a->rz_szB = rz_szB;
while (0 != overhead_szB_lo(a) % VG_MIN_MALLOC_SZB) a->rz_szB++;
- // vg_assert(overhead_szB_lo(a) == overhead_szB_hi(a));
- vg_assert(0 == overhead_szB_lo(a) % VG_MIN_MALLOC_SZB);
- vg_assert(0 == overhead_szB_hi(a) % VG_MIN_MALLOC_SZB);
+ vg_assert(overhead_szB_lo(a) - hp_overhead_szB() == overhead_szB_hi(a));
a->min_sblock_szB = min_sblock_szB;
for (i = 0; i < N_MALLOC_LISTS; i++) a->freelist[i] = NULL;
|