which can fill up the allocation trees with uninteresting information.
This option can be specified multiple times on the command line, to
name multiple functions.</para>
-
+
+ <para>Note that the named function will only be treated this way if it is
+ the top entry in a stack trace, or just below another function treated
+ this way. For example, if you have a function
+ <function>malloc1</function> that wraps <function>malloc</function>,
+ and <function>malloc2</function> that wraps
+ <function>malloc1</function>, just specifying
+ <option>--alloc-fn=malloc2</option> will have no effect. You need to
+ specify <option>--alloc-fn=malloc1</option> as well. This is a little
+ inconvenient, but the reason is that checking for allocation functions
+ is slow, and it saves a lot of time if Massif can stop looking through
+ the stack trace entries as soon as it finds one that doesn't match
+ rather than having to continue through all the entries.</para>
+
<para>Note that C++ names are demangled. Note also that overloaded
C++ names must be written in full. Single quotes may be necessary to
prevent the shell from breaking them up. For example:
// If the original stack trace is smaller than asked-for, redo=False.
if (n_ips < clo_depth + overestimate) { redo = False; }
- // If it's a non-custom block, we will always remove the first stack
- // trace entry (which will be one of malloc, __builtin_new, etc).
- n_alloc_fns_removed = ( is_custom_alloc ? 0 : 1 );
-
// Filter out alloc fns. If it's a non-custom block, we remove the
// first entry (which will be one of malloc, __builtin_new, etc)
// without looking at it, because VG_(get_fnname) is expensive (it
// involves calls to VG_(malloc)/VG_(free)).
+ n_alloc_fns_removed = ( is_custom_alloc ? 0 : 1 );
for (i = n_alloc_fns_removed; i < n_ips; i++) {
if (VG_(get_fnname)(ips[i], buf, BUF_LEN)) {
if (is_member_fn(alloc_fns, buf)) {