Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions coregrind/m_mallocfree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2138,8 +2138,18 @@ void VG_(arena_free) ( ArenaId aid, void* ptr )
carefully chosen junk :-), in that: (1) 0xDDDDDDDD is an invalid
and non-word-aligned address on most systems, and (2) 0xDD is a
value which is unlikely to be generated by the new compressed
Vbits representation for memcheck. */
if (aid != VG_AR_CLIENT)
Vbits representation for memcheck.

CodSpeed: this is a pure debugging aid (it only makes use-after-free
bugs *in V itself* more likely to be noticed), but it is expensive:
it writes every byte of every block V frees, which on a debuginfo
heavy run amounts to hundreds of MB of stores plus the page faults
needed to first-touch the parts of a block that were never used.
It is therefore only done at the sanity levels reserved for
expensive self-checks (--sanity-level=3 and above); the matching
fill on the malloc side is disabled by default for the same
reason (see VG_(arena_malloc)). */
if (aid != VG_AR_CLIENT && UNLIKELY(VG_(clo_sanity_level) >= 3))
VG_(memset)(ptr, 0xDD, (SizeT)b_pszB);

if (! sb->unsplittable) {
Expand Down
Loading