The selection is not completely under your control; freedom is also almost impossible for you. This should be added to the list of known, detected, recorded, but ignored elements (โsuppressedโ is jargon).
When I run the program under valgrind 3.7.0 on MacOS X 10.7.2, I get the following message:
==71989== ==71989== HEAP SUMMARY: ==71989== in use at exit: 6,191 bytes in 33 blocks ==71989== total heap usage: 33 allocs, 0 frees, 6,191 bytes allocated ==71989== ==71989== LEAK SUMMARY: ==71989== definitely lost: 0 bytes in 0 blocks ==71989== indirectly lost: 0 bytes in 0 blocks ==71989== possibly lost: 0 bytes in 0 blocks ==71989== still reachable: 6,191 bytes in 33 blocks ==71989== suppressed: 0 bytes in 0 blocks ==71989== Rerun with
This is from a program that has no explicit memory allocation. printf() may initiate some distribution, but most of these bytes are allocated in system libraries. --num-callers=N clearly deeper than the normal value for the trace ( --num-callers=N ).
See the manual on how to correctly add a suppression entry, but valgrind --help suggests:
--num-callers=<number> show <number> callers in stack traces [12] --error-limit=no|yes stop showing new errors if too many? [yes] --error-exitcode=<number> exit code to return if errors found [0=disable] --show-below-main=no|yes continue stack traces below main() [no] --suppressions=<filename> suppress errors described in <filename> --gen-suppressions=no|yes|all print suppressions for errors? [no]
So you can get valgrind to generate a suppression string, which you can add to the file, which you then use in subsequent runs.
Extra options read from ~/.valgrindrc, $VALGRIND_OPTS, ./.valgrindrc
source share