What techniques can we employ to speed things up (whilst retaining most of the 
value)?

In general, memcheck runs faster when it emulates fewer instructions.  So 
compile with
-O2 to get smaller code size.  The flag -Os means "prefer small code size" but 
is
little used, so there just might be more compiler bugs.  Secondly, do whatever
it takes to *avoid* inlining string functions such as strlen etc.  You want 
memcheck
to replace the entire logical function call with a memcheck internal equivalent.
Unfortunately the gcc flags -fno-builtin* have documentation that is hard to 
understand.

The memcheck option --expensive-definedness-checks= already defaults to 'no'.
Specifying --redzone-size=8 might save 16 bytes of memory for each allocation,
which helps if there are many small allocations.  But default --alignment=16
is required for common SSE2 instructions [used by other glibc routines on the 
blocks,
etc.], and the redzone is not the only per-block overhead (see 
--keep-stacktraces=
and --num-callers=), so experimentation may be required.

If all you care about is memory leaks, then experiment with 
--undef-value-errors=no
and even non-valgrind tools [such as mtrace (malloc trace)] that are specialized
for detecting leaks.


_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to