Merge r9103 and r9105 (add --ignore-fn to Massif) from the Darwin branch.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9567 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/massif/docs/ms-manual.xml b/massif/docs/ms-manual.xml
index 81a066e..7637e47 100644
--- a/massif/docs/ms-manual.xml
+++ b/massif/docs/ms-manual.xml
@@ -614,6 +614,33 @@
       </listitem>
   </varlistentry>
 
+  <varlistentry id="opt.ignore-fn" xreflabel="--ignore-fn">
+    <term>
+      <option><![CDATA[--ignore-fn=<name> ]]></option>
+    </term>
+    <listitem>
+      <para>Any direct heap allocation (i.e. a call to
+      <function>malloc</function>, <function>new</function>, etc, or a call
+      to a function name in a <computeroutput>--alloc-fn</computeroutput>
+      option) that occurs in a function specified by this option will be
+      ignored.  This is mostly useful for testing purposes.  This option can
+      be specified multiple times on the command line, to name multiple
+      functions.
+      </para>
+      
+      <para>Any <function>realloc</function> of an ignored block will
+      also be ignored, even if the <function>realloc</function> call does
+      not occur in an ignored function.  This avoids the possibility of
+      negative heap sizes if ignored blocks are shrunk with
+      <function>realloc</function>.
+      </para>
+      
+      <para>Note that overloaded C++ names must be written in full, as for
+      <computeroutput>--alloc-fn</computeroutput> above.
+      </para>
+      </listitem>
+  </varlistentry>
+
   <varlistentry id="opt.threshold" xreflabel="--threshold">
     <term>
       <option><![CDATA[--threshold=<m.n> [default: 1.0] ]]></option>
diff --git a/massif/ms_main.c b/massif/ms_main.c
index ee85908..7cd2603 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -233,22 +233,25 @@
 //  -  15,000 XPts            800,000 XPts
 //  -   1,800 top-XPts
 
-static UInt n_heap_allocs          = 0;
-static UInt n_heap_reallocs        = 0;
-static UInt n_heap_frees           = 0;
-static UInt n_stack_allocs         = 0;
-static UInt n_stack_frees          = 0;
-static UInt n_xpts                 = 0;
-static UInt n_xpt_init_expansions  = 0;
-static UInt n_xpt_later_expansions = 0;
-static UInt n_sxpt_allocs          = 0;
-static UInt n_sxpt_frees           = 0;
-static UInt n_skipped_snapshots    = 0;
-static UInt n_real_snapshots       = 0;
-static UInt n_detailed_snapshots   = 0;
-static UInt n_peak_snapshots       = 0;
-static UInt n_cullings             = 0;
-static UInt n_XCon_redos           = 0;
+static UInt n_heap_allocs           = 0;
+static UInt n_heap_reallocs         = 0;
+static UInt n_heap_frees            = 0;
+static UInt n_ignored_heap_allocs   = 0;
+static UInt n_ignored_heap_frees    = 0;
+static UInt n_ignored_heap_reallocs = 0;
+static UInt n_stack_allocs          = 0;
+static UInt n_stack_frees           = 0;
+static UInt n_xpts                  = 0;
+static UInt n_xpt_init_expansions   = 0;
+static UInt n_xpt_later_expansions  = 0;
+static UInt n_sxpt_allocs           = 0;
+static UInt n_sxpt_frees            = 0;
+static UInt n_skipped_snapshots     = 0;
+static UInt n_real_snapshots        = 0;
+static UInt n_detailed_snapshots    = 0;
+static UInt n_peak_snapshots        = 0;
+static UInt n_cullings              = 0;
+static UInt n_XCon_redos            = 0;
 
 //------------------------------------------------------------//
 //--- Globals                                              ---//
@@ -286,6 +289,7 @@
 //------------------------------------------------------------//
 
 static XArray* alloc_fns;
+static XArray* ignore_fns;
 
 static void init_alloc_fns(void)
 {
@@ -315,18 +319,26 @@
    DO("operator new[](unsigned long, std::nothrow_t const&)");
 }
 
-static Bool is_alloc_fn(Char* fnname)
+static void init_ignore_fns(void)
 {
-   Char** alloc_fn_ptr;
+   // Create the (empty) list.
+   ignore_fns = VG_(newXA)(VG_(malloc), "ms.main.iif.1",
+                                        VG_(free), sizeof(Char*));
+}
+
+// Determines if the named function is a member of the XArray.
+static Bool is_member_fn(XArray* fns, Char* fnname)
+{
+   Char** fn_ptr;
    Int i;
  
    // Nb: It's a linear search through the list, because we're comparing
    // strings rather than pointers to strings.
    // Nb: This gets called a lot.  It was an OSet, but they're quite slow to
    // iterate through so it wasn't a good choice.
-   for (i = 0; i < VG_(sizeXA)(alloc_fns); i++) {
-      alloc_fn_ptr = VG_(indexXA)(alloc_fns, i);
-      if (VG_STREQ(fnname, *alloc_fn_ptr))
+   for (i = 0; i < VG_(sizeXA)(fns); i++) {
+      fn_ptr = VG_(indexXA)(fns, i);
+      if (VG_STREQ(fnname, *fn_ptr))
          return True;
    }
    return False;
@@ -395,7 +407,9 @@
    else if VG_STR_CLO(arg, "--alloc-fn", tmp_str) {
       VG_(addToXA)(alloc_fns, &tmp_str);
    }
-
+   else if VG_STR_CLO(arg, "--ignore-fn", tmp_str) {
+      VG_(addToXA)(ignore_fns, &tmp_str);
+   }
    else if VG_STR_CLO(arg, "--massif-out-file", clo_massif_out_file) {}
 
    else
@@ -412,7 +426,8 @@
 "                               ignored if --heap=no [8]\n"
 "    --stacks=no|yes           profile stack(s) [no]\n"
 "    --depth=<number>          depth of contexts [30]\n"
-"    --alloc-fn=<name>         specify <fn> as an alloc function [empty]\n"
+"    --alloc-fn=<name>         specify <name> as an alloc function [empty]\n"
+"    --ignore-fn=<name>        ignore heap allocations within <name> [empty]\n"
 "    --threshold=<m.n>         significance threshold, as a percentage [1.0]\n"
 "    --peak-inaccuracy=<m.n>   maximum peak inaccuracy, as a percentage [1.0]\n"
 "    --time-unit=i|ms|B        time unit: instructions executed, milliseconds\n"
@@ -780,6 +795,15 @@
 // enough.
 #define BUF_LEN   2048
 
+// Determine if the given IP belongs to a function that should be ignored.
+static Bool fn_should_be_ignored(Addr ip)
+{
+   static Char buf[BUF_LEN];
+   return
+      ( VG_(get_fnname)(ip, buf, BUF_LEN) && is_member_fn(ignore_fns, buf)
+      ? True : False );
+}
+
 // Get the stack trace for an XCon, filtering out uninteresting entries:
 // alloc-fns and entries above alloc-fns, and entries below main-or-below-main.
 //   Eg:       alloc-fn1 / alloc-fn2 / a / b / main / (below main) / c
@@ -789,7 +813,7 @@
 static
 Int get_IPs( ThreadId tid, Bool is_custom_alloc, Addr ips[])
 {
-   Char buf[BUF_LEN];
+   static Char buf[BUF_LEN];
    Int n_ips, i, n_alloc_fns_removed;
    Int overestimate;
    Bool redo;
@@ -832,7 +856,7 @@
       // involves calls to VG_(malloc)/VG_(free)).
       for (i = n_alloc_fns_removed; i < n_ips; i++) {
          if (VG_(get_fnname)(ips[i], buf, BUF_LEN)) {
-            if (is_alloc_fn(buf)) {
+            if (is_member_fn(alloc_fns, buf)) {
                n_alloc_fns_removed++;
             } else {
                break;
@@ -859,15 +883,22 @@
 }
 
 // Gets an XCon and puts it in the tree.  Returns the XCon's bottom-XPt.
+// Unless the allocation should be ignored, in which case we return NULL.
 static XPt* get_XCon( ThreadId tid, Bool is_custom_alloc )
 {
-   Addr ips[MAX_IPS];
+   static Addr ips[MAX_IPS];
    Int i;
    XPt* xpt = alloc_xpt;
 
    // After this call, the IPs we want are in ips[0]..ips[n_ips-1].
    Int n_ips = get_IPs(tid, is_custom_alloc, ips);
 
+   // Should we ignore this allocation?  (Nb: n_ips can be zero, eg. if
+   // 'main' is marked as an alloc-fn.)
+   if (n_ips > 0 && fn_should_be_ignored(ips[0])) {
+      return NULL;
+   }
+
    // Now do the search/insertion of the XCon.
    for (i = 0; i < n_ips; i++) {
       Addr ip = ips[i];
@@ -1489,18 +1520,27 @@
    if (clo_heap) {
       VERB(3, "<<< new_mem_heap (%lu, %lu)", req_szB, slop_szB);
 
-      // Update statistics.
-      n_heap_allocs++;
-
-      // Update heap stats.
-      update_heap_stats(req_szB, clo_heap_admin + slop_szB);
-
-      // Update XTree.
       hc->where = get_XCon( tid, is_custom_alloc );
-      update_XCon(hc->where, req_szB);
 
-      // Maybe take a snapshot.
-      maybe_take_snapshot(Normal, "  alloc");
+      if (hc->where) {
+         // Update statistics.
+         n_heap_allocs++;
+
+         // Update heap stats.
+         update_heap_stats(req_szB, clo_heap_admin + slop_szB);
+
+         // Update XTree.
+         update_XCon(hc->where, req_szB);
+
+         // Maybe take a snapshot.
+         maybe_take_snapshot(Normal, "  alloc");
+
+      } else {
+         // Ignored allocation.
+         n_ignored_heap_allocs++;
+
+         VERB(3, "(ignored)");
+      }
 
       VERB(3, ">>>");
    }
@@ -1522,20 +1562,27 @@
    if (clo_heap) {
       VERB(3, "<<< die_mem_heap");
 
-      // Update statistics
-      n_heap_frees++;
+      if (hc->where) {
+         // Update statistics.
+         n_heap_frees++;
 
-      // Maybe take a peak snapshot, since it's a deallocation.
-      maybe_take_snapshot(Peak, "de-PEAK");
+         // Maybe take a peak snapshot, since it's a deallocation.
+         maybe_take_snapshot(Peak, "de-PEAK");
 
-      // Update heap stats.
-      update_heap_stats(-hc->req_szB, -clo_heap_admin - hc->slop_szB);
+         // Update heap stats.
+         update_heap_stats(-hc->req_szB, -clo_heap_admin - hc->slop_szB);
 
-      // Update XTree.
-      update_XCon(hc->where, -hc->req_szB);
+         // Update XTree.
+         update_XCon(hc->where, -hc->req_szB);
 
-      // Maybe take a snapshot.
-      maybe_take_snapshot(Normal, "dealloc");
+         // Maybe take a snapshot.
+         maybe_take_snapshot(Normal, "dealloc");
+
+      } else {
+         n_ignored_heap_frees++;
+
+         VERB(3, "(ignored)");
+      }
 
       VERB(3, ">>> (-%lu, -%lu)", hc->req_szB, hc->slop_szB);
    }
@@ -1546,6 +1593,12 @@
       VG_(cli_free)( p );
 }
 
+// Nb: --ignore-fn is tricky for realloc.  If the block's original alloc was
+// ignored, but the realloc is not requested to be ignored, and we are
+// shrinking the block, then we have to ignore the realloc -- otherwise we
+// could end up with negative heap sizes.  This isn't a danger if we are
+// growing such a block, but for consistency (it also simplifies things) we
+// ignore such reallocs as well.
 static __inline__
 void* renew_block ( ThreadId tid, void* p_old, SizeT new_req_szB )
 {
@@ -1553,6 +1606,7 @@
    void*     p_new;
    SizeT     old_req_szB, old_slop_szB, new_slop_szB, new_actual_szB;
    XPt      *old_where, *new_where;
+   Bool      is_ignored = False;
 
    // Remove the old block
    hc = VG_(HT_remove)(malloc_list, (UWord)p_old);
@@ -1566,12 +1620,18 @@
    if (clo_heap) {
       VERB(3, "<<< renew_mem_heap (%lu)", new_req_szB);
 
-      // Update statistics
-      n_heap_reallocs++;
+      if (hc->where) {
+         // Update statistics.
+         n_heap_reallocs++;
 
-      // Maybe take a peak snapshot, if it's (effectively) a deallocation.
-      if (new_req_szB < old_req_szB) {
-         maybe_take_snapshot(Peak, "re-PEAK");
+         // Maybe take a peak snapshot, if it's (effectively) a deallocation.
+         if (new_req_szB < old_req_szB) {
+            maybe_take_snapshot(Peak, "re-PEAK");
+         }
+      } else {
+         // The original malloc was ignored, so we have to ignore the
+         // realloc as well.
+         is_ignored = True;
       }
    }
 
@@ -1607,9 +1667,17 @@
       // Update XTree.
       if (clo_heap) {
          new_where = get_XCon( tid, /*custom_malloc*/False);
-         hc->where = new_where;
-         update_XCon(old_where, -old_req_szB);
-         update_XCon(new_where,  new_req_szB);
+         if (!is_ignored && new_where) {
+            hc->where = new_where;
+            update_XCon(old_where, -old_req_szB);
+            update_XCon(new_where,  new_req_szB);
+         } else {
+            // The realloc itself is ignored.
+            is_ignored = True;
+
+            // Update statistics.
+            n_ignored_heap_reallocs++;
+         }
       }
    }
 
@@ -1621,11 +1689,17 @@
    VG_(HT_add_node)(malloc_list, hc);
 
    if (clo_heap) {
-      // Update heap stats.
-      update_heap_stats(new_req_szB - old_req_szB, new_slop_szB - old_slop_szB);
+      if (!is_ignored) {
+         // Update heap stats.
+         update_heap_stats(new_req_szB - old_req_szB,
+                          new_slop_szB - old_slop_szB);
 
-      // Maybe take a snapshot.
-      maybe_take_snapshot(Normal, "realloc");
+         // Maybe take a snapshot.
+         maybe_take_snapshot(Normal, "realloc");
+      } else {
+
+         VERB(3, "(ignored)");
+      }
 
       VERB(3, ">>> (%ld, %ld)",
          new_req_szB - old_req_szB, new_slop_szB - old_slop_szB);
@@ -2125,25 +2199,28 @@
 
    // Stats
    tl_assert(n_xpts > 0);  // always have alloc_xpt
-   VERB(1, "heap allocs:          %u", n_heap_allocs);
-   VERB(1, "heap reallocs:        %u", n_heap_reallocs);
-   VERB(1, "heap frees:           %u", n_heap_frees);
-   VERB(1, "stack allocs:         %u", n_stack_allocs);
-   VERB(1, "stack frees:          %u", n_stack_frees);
-   VERB(1, "XPts:                 %u", n_xpts);
-   VERB(1, "top-XPts:             %u (%d%%)",
+   VERB(1, "heap allocs:           %u", n_heap_allocs);
+   VERB(1, "heap reallocs:         %u", n_heap_reallocs);
+   VERB(1, "heap frees:            %u", n_heap_frees);
+   VERB(1, "ignored heap allocs:   %u", n_ignored_heap_allocs);
+   VERB(1, "ignored heap frees:    %u", n_ignored_heap_frees);
+   VERB(1, "ignored heap reallocs: %u", n_ignored_heap_reallocs);
+   VERB(1, "stack allocs:          %u", n_stack_allocs);
+   VERB(1, "stack frees:           %u", n_stack_frees);
+   VERB(1, "XPts:                  %u", n_xpts);
+   VERB(1, "top-XPts:              %u (%d%%)",
       alloc_xpt->n_children,
       ( n_xpts ? alloc_xpt->n_children * 100 / n_xpts : 0));
-   VERB(1, "XPt init expansions:  %u", n_xpt_init_expansions);
-   VERB(1, "XPt later expansions: %u", n_xpt_later_expansions);
-   VERB(1, "SXPt allocs:          %u", n_sxpt_allocs);
-   VERB(1, "SXPt frees:           %u", n_sxpt_frees);
-   VERB(1, "skipped snapshots:    %u", n_skipped_snapshots);
-   VERB(1, "real snapshots:       %u", n_real_snapshots);
-   VERB(1, "detailed snapshots:   %u", n_detailed_snapshots);
-   VERB(1, "peak snapshots:       %u", n_peak_snapshots);
-   VERB(1, "cullings:             %u", n_cullings);
-   VERB(1, "XCon redos:           %u", n_XCon_redos);
+   VERB(1, "XPt init expansions:   %u", n_xpt_init_expansions);
+   VERB(1, "XPt later expansions:  %u", n_xpt_later_expansions);
+   VERB(1, "SXPt allocs:           %u", n_sxpt_allocs);
+   VERB(1, "SXPt frees:            %u", n_sxpt_frees);
+   VERB(1, "skipped snapshots:     %u", n_skipped_snapshots);
+   VERB(1, "real snapshots:        %u", n_real_snapshots);
+   VERB(1, "detailed snapshots:    %u", n_detailed_snapshots);
+   VERB(1, "peak snapshots:        %u", n_peak_snapshots);
+   VERB(1, "cullings:              %u", n_cullings);
+   VERB(1, "XCon redos:            %u", n_XCon_redos);
 }
 
 
@@ -2167,12 +2244,21 @@
       clo_heap_admin = 0;
    }
 
-   // Print alloc-fns, if necessary.
+   // Print alloc-fns and ignore-fns, if necessary.
    if (VG_(clo_verbosity) > 1) {
       VERB(1, "alloc-fns:");
       for (i = 0; i < VG_(sizeXA)(alloc_fns); i++) {
-         Char** alloc_fn_ptr = VG_(indexXA)(alloc_fns, i);
-         VERB(1, "  %d: %s", i, *alloc_fn_ptr);
+         Char** fn_ptr = VG_(indexXA)(alloc_fns, i);
+         VERB(1, "  %d: %s", i, *fn_ptr);
+      }
+
+      VERB(1, "ignore-fns:");
+      if (0 == VG_(sizeXA)(ignore_fns)) {
+         VERB(1, "  <empty>");
+      }
+      for (i = 0; i < VG_(sizeXA)(ignore_fns); i++) {
+         Char** fn_ptr = VG_(indexXA)(ignore_fns, i);
+         VERB(1, "  %d: %s", i, *fn_ptr);
       }
    }
 
@@ -2204,12 +2290,12 @@
       "Copyright (C) 2003-2009, and GNU GPL'd, by Nicholas Nethercote");
    VG_(details_bug_reports_to)  (VG_BUGS_TO);
 
-   // Basic functions
+   // Basic functions.
    VG_(basic_tool_funcs)          (ms_post_clo_init,
                                    ms_instrument,
                                    ms_fini);
 
-   // Needs
+   // Needs.
    VG_(needs_libc_freeres)();
    VG_(needs_command_line_options)(ms_process_cmd_line_option,
                                    ms_print_usage,
@@ -2229,14 +2315,15 @@
                                    ms_malloc_usable_size,
                                    0 );
 
-   // HP_Chunks
+   // HP_Chunks.
    malloc_list = VG_(HT_construct)( "Massif's malloc list" );
 
    // Dummy node at top of the context structure.
    alloc_xpt = new_XPt(/*ip*/0, /*parent*/NULL);
 
-   // Initialise alloc_fns.
+   // Initialise alloc_fns and ignore_fns.
    init_alloc_fns();
+   init_ignore_fns();
 
    // Initialise args_for_massif.
    args_for_massif = VG_(newXA)(VG_(malloc), "ms.main.mprci.1", 
diff --git a/massif/tests/Makefile.am b/massif/tests/Makefile.am
index 7fffa0f..b966a6c 100644
--- a/massif/tests/Makefile.am
+++ b/massif/tests/Makefile.am
@@ -8,7 +8,6 @@
 	alloc-fns-B.post.exp alloc-fns-B.stderr.exp alloc-fns-B.vgtest \
 	basic.post.exp basic.stderr.exp basic.vgtest \
 	basic2.post.exp basic2.stderr.exp basic2.vgtest \
-	insig.post.exp insig.stderr.exp insig.vgtest \
 	big-alloc.post.exp big-alloc.stderr.exp big-alloc.vgtest \
 	deep-A.post.exp deep-A.stderr.exp deep-A.vgtest \
 	deep-B.post.exp deep-B.stderr.exp deep-B.vgtest \
@@ -17,7 +16,9 @@
         culling1.stderr.exp culling1.vgtest \
         culling2.stderr.exp culling2.vgtest \
 	custom_alloc.post.exp custom_alloc.stderr.exp custom_alloc.vgtest \
+	ignored.post.exp ignored.stderr.exp ignored.vgtest \
 	ignoring.post.exp ignoring.stderr.exp ignoring.vgtest \
+	insig.post.exp insig.stderr.exp insig.vgtest \
 	long-names.post.exp long-names.stderr.exp long-names.vgtest \
 	long-time.post.exp long-time.stderr.exp long-time.vgtest \
 	malloc_usable.stderr.exp malloc_usable.vgtest \
@@ -45,6 +46,7 @@
 	culling1 culling2 \
 	custom_alloc \
 	deep \
+	ignored \
 	ignoring \
 	insig \
 	long-names \
diff --git a/massif/tests/alloc-fns-A.post.exp b/massif/tests/alloc-fns-A.post.exp
index 447f2c9..5578389 100644
--- a/massif/tests/alloc-fns-A.post.exp
+++ b/massif/tests/alloc-fns-A.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./alloc-fns
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/alloc-fns-A.vgtest b/massif/tests/alloc-fns-A.vgtest
index ab6615a..99cd1c8 100644
--- a/massif/tests/alloc-fns-A.vgtest
+++ b/massif/tests/alloc-fns-A.vgtest
@@ -1,4 +1,5 @@
 prog: alloc-fns
 vgopts: --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/alloc-fns-B.post.exp b/massif/tests/alloc-fns-B.post.exp
index 372cd61..5dd3c79 100644
--- a/massif/tests/alloc-fns-B.post.exp
+++ b/massif/tests/alloc-fns-B.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./alloc-fns
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --alloc-fn=a4 --alloc-fn=b4 --alloc-fn=b3 --alloc-fn=c4 --alloc-fn=c3 --alloc-fn=c2 --alloc-fn=d4 --alloc-fn=d3 --alloc-fn=d2 --alloc-fn=d1 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --alloc-fn=a4 --alloc-fn=b4 --alloc-fn=b3 --alloc-fn=c4 --alloc-fn=c3 --alloc-fn=c2 --alloc-fn=d4 --alloc-fn=d3 --alloc-fn=d2 --alloc-fn=d1 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/alloc-fns-B.vgtest b/massif/tests/alloc-fns-B.vgtest
index 44a6b60..dd25f56 100644
--- a/massif/tests/alloc-fns-B.vgtest
+++ b/massif/tests/alloc-fns-B.vgtest
@@ -1,4 +1,5 @@
 prog: alloc-fns
 vgopts: --stacks=no --time-unit=B --heap-admin=0 --alloc-fn=a4 --alloc-fn=b4 --alloc-fn=b3 --alloc-fn=c4 --alloc-fn=c3 --alloc-fn=c2 --alloc-fn=d4 --alloc-fn=d3 --alloc-fn=d2 --alloc-fn=d1 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/basic.post.exp b/massif/tests/basic.post.exp
index e2b8d06..db309fa 100644
--- a/massif/tests/basic.post.exp
+++ b/massif/tests/basic.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./basic
-Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/basic.vgtest b/massif/tests/basic.vgtest
index a4f52a7..bfe7cd8 100644
--- a/massif/tests/basic.vgtest
+++ b/massif/tests/basic.vgtest
@@ -1,4 +1,5 @@
 prog: basic
 vgopts: --stacks=no --time-unit=B --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/basic2.post.exp b/massif/tests/basic2.post.exp
index 7b617d0..753761b 100644
--- a/massif/tests/basic2.post.exp
+++ b/massif/tests/basic2.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./basic
-Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out --detailed-freq=1 --max-snapshots=10
+Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out --detailed-freq=1 --max-snapshots=10 --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/basic2.vgtest b/massif/tests/basic2.vgtest
index e9d1de4..baa43aa 100644
--- a/massif/tests/basic2.vgtest
+++ b/massif/tests/basic2.vgtest
@@ -1,4 +1,5 @@
 prog: basic
 vgopts: --stacks=no --time-unit=B --massif-out-file=massif.out --detailed-freq=1 --max-snapshots=10
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/big-alloc.post.exp b/massif/tests/big-alloc.post.exp
index 29a40f7..dc9a980 100644
--- a/massif/tests/big-alloc.post.exp
+++ b/massif/tests/big-alloc.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./big-alloc
-Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/big-alloc.vgtest b/massif/tests/big-alloc.vgtest
index abdefdd..2937f37 100644
--- a/massif/tests/big-alloc.vgtest
+++ b/massif/tests/big-alloc.vgtest
@@ -1,4 +1,5 @@
 prog: big-alloc
 vgopts: --stacks=no --time-unit=B --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/culling1.stderr.exp b/massif/tests/culling1.stderr.exp
index 2faf8ae..566b130 100644
--- a/massif/tests/culling1.stderr.exp
+++ b/massif/tests/culling1.stderr.exp
@@ -13,6 +13,11 @@
 Massif:   11: operator new[](unsigned, std::nothrow_t const&)
 Massif:   12: operator new(unsigned long, std::nothrow_t const&)
 Massif:   13: operator new[](unsigned long, std::nothrow_t const&)
+Massif: ignore-fns:
+Massif:   0: __part_load_locale
+Massif:   1: __time_load_locale
+Massif:   2: dwarf2_unwind_dyld_add_image_hook
+Massif:   3: get_or_create_key_element
 Massif: startup S.  0 (t:0, hp:0, ex:0, st:0)
 Massif:   alloc S.  1 (t:32, hp:16, ex:16, st:0)
 Massif:   alloc S.  2 (t:64, hp:32, ex:32, st:0)
@@ -419,20 +424,23 @@
 Massif:   post-cull S. 48 (t:6240, hp:3120, ex:3120, st:0)
 Massif:   post-cull Sd 49 (t:6368, hp:3184, ex:3184, st:0)
 Massif: New time interval = 128 (between snapshots 0 and 1)
-Massif: heap allocs:          200
-Massif: heap reallocs:        0
-Massif: heap frees:           0
-Massif: stack allocs:         0
-Massif: stack frees:          0
+Massif: heap allocs:           200
+Massif: heap reallocs:         0
+Massif: heap frees:            0
+Massif: ignored heap allocs:   ...
+Massif: ignored heap frees:    ...
+Massif: ignored heap reallocs: ...
+Massif: stack allocs:          0
+Massif: stack frees:           0
 Massif: XPts:                 ...
 Massif: top-XPts:             ...
 Massif: XPt init expansions:  ...
 Massif: XPt later expansions: ...
 Massif: SXPt allocs:          ...
 Massif: SXPt frees:           ...
-Massif: skipped snapshots:    51
-Massif: real snapshots:       150
-Massif: detailed snapshots:   15
-Massif: peak snapshots:       0
-Massif: cullings:             2
+Massif: skipped snapshots:     51
+Massif: real snapshots:        150
+Massif: detailed snapshots:    15
+Massif: peak snapshots:        0
+Massif: cullings:              2
 Massif: XCon redos:           ...
diff --git a/massif/tests/culling1.vgtest b/massif/tests/culling1.vgtest
index b675857..c282f9b 100644
--- a/massif/tests/culling1.vgtest
+++ b/massif/tests/culling1.vgtest
@@ -1,4 +1,5 @@
 prog: culling1
 vgopts: -v -v --stacks=no --time-unit=B --heap-admin=16 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 stderr_filter: filter_verbose
 cleanup: rm massif.out
diff --git a/massif/tests/culling2.stderr.exp b/massif/tests/culling2.stderr.exp
index 3f58e13..a928a13 100644
--- a/massif/tests/culling2.stderr.exp
+++ b/massif/tests/culling2.stderr.exp
@@ -13,6 +13,11 @@
 Massif:   11: operator new[](unsigned, std::nothrow_t const&)
 Massif:   12: operator new(unsigned long, std::nothrow_t const&)
 Massif:   13: operator new[](unsigned long, std::nothrow_t const&)
+Massif: ignore-fns:
+Massif:   0: __part_load_locale
+Massif:   1: __time_load_locale
+Massif:   2: dwarf2_unwind_dyld_add_image_hook
+Massif:   3: get_or_create_key_element
 Massif: startup S.  0 (t:0, hp:0, ex:0, st:0)
 Massif:   alloc S.  1 (t:16, hp:0, ex:16, st:0)
 Massif:   alloc S.  2 (t:432, hp:400, ex:32, st:0)
@@ -522,20 +527,23 @@
 Massif:   post-cull S. 48 (t:7647136, hp:7644000, ex:3136, st:0)
 Massif:   post-cull Sd 49 (t:7883584, hp:7880400, ex:3184, st:0)
 Massif: New time interval = 113728 (between snapshots 1 and 2)
-Massif: heap allocs:          200
-Massif: heap reallocs:        0
-Massif: heap frees:           0
-Massif: stack allocs:         0
-Massif: stack frees:          0
+Massif: heap allocs:           200
+Massif: heap reallocs:         0
+Massif: heap frees:            0
+Massif: ignored heap allocs:   ...
+Massif: ignored heap frees:    ...
+Massif: ignored heap reallocs: ...
+Massif: stack allocs:          0
+Massif: stack frees:           0
 Massif: XPts:                 ...
 Massif: top-XPts:             ...
 Massif: XPt init expansions:  ...
 Massif: XPt later expansions: ...
 Massif: SXPt allocs:          ...
 Massif: SXPt frees:           ...
-Massif: skipped snapshots:    1
-Massif: real snapshots:       200
-Massif: detailed snapshots:   20
-Massif: peak snapshots:       0
-Massif: cullings:             3
+Massif: skipped snapshots:     1
+Massif: real snapshots:        200
+Massif: detailed snapshots:    20
+Massif: peak snapshots:        0
+Massif: cullings:              3
 Massif: XCon redos:           ...
diff --git a/massif/tests/culling2.vgtest b/massif/tests/culling2.vgtest
index 3e8fa0c..9cd6032 100644
--- a/massif/tests/culling2.vgtest
+++ b/massif/tests/culling2.vgtest
@@ -1,4 +1,5 @@
 prog: culling2
 vgopts: -v -v --stacks=no --time-unit=B --heap-admin=16 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 stderr_filter: filter_verbose
 cleanup: rm massif.out
diff --git a/massif/tests/custom_alloc.post.exp b/massif/tests/custom_alloc.post.exp
index 57d5701..a1c0ee0 100644
--- a/massif/tests/custom_alloc.post.exp
+++ b/massif/tests/custom_alloc.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./custom_alloc
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=16 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=16 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/custom_alloc.vgtest b/massif/tests/custom_alloc.vgtest
index 429f77b..3d5e916 100644
--- a/massif/tests/custom_alloc.vgtest
+++ b/massif/tests/custom_alloc.vgtest
@@ -1,4 +1,5 @@
 prog: custom_alloc
 vgopts: --stacks=no --time-unit=B --heap-admin=16 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/deep-A.post.exp b/massif/tests/deep-A.post.exp
index 57da335..84eaf56 100644
--- a/massif/tests/deep-A.post.exp
+++ b/massif/tests/deep-A.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./deep
-Massif arguments:   --stacks=no --time-unit=B --depth=8 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --depth=8 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/deep-A.vgtest b/massif/tests/deep-A.vgtest
index 20a81a7..840aae6 100644
--- a/massif/tests/deep-A.vgtest
+++ b/massif/tests/deep-A.vgtest
@@ -1,4 +1,5 @@
 prog: deep
 vgopts: --stacks=no --time-unit=B --depth=8 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/deep-B.post.exp b/massif/tests/deep-B.post.exp
index 66b9aba..c1a164d 100644
--- a/massif/tests/deep-B.post.exp
+++ b/massif/tests/deep-B.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./deep
-Massif arguments:   --stacks=no --time-unit=B --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 --depth=8 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 --depth=8 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/deep-B.stderr.exp b/massif/tests/deep-B.stderr.exp
index 0723baa..59fe6ee 100644
--- a/massif/tests/deep-B.stderr.exp
+++ b/massif/tests/deep-B.stderr.exp
@@ -20,6 +20,11 @@
 Massif:   18: a10
 Massif:   19: a11
 Massif:   20: a12
+Massif: ignore-fns:
+Massif:   0: __part_load_locale
+Massif:   1: __time_load_locale
+Massif:   2: dwarf2_unwind_dyld_add_image_hook
+Massif:   3: get_or_create_key_element
 Massif: startup S.  0 (t:0, hp:0, ex:0, st:0)
 Massif:   alloc S.  1 (t:408, hp:400, ex:8, st:0)
 Massif:   alloc S.  2 (t:816, hp:800, ex:16, st:0)
@@ -31,20 +36,23 @@
 Massif:   alloc S.  8 (t:3264, hp:3200, ex:64, st:0)
 Massif:   alloc Sd  9 (t:3672, hp:3600, ex:72, st:0)
 Massif:   alloc S. 10 (t:4080, hp:4000, ex:80, st:0)
-Massif: heap allocs:          10
-Massif: heap reallocs:        0
-Massif: heap frees:           0
-Massif: stack allocs:         0
-Massif: stack frees:          0
+Massif: heap allocs:           10
+Massif: heap reallocs:         0
+Massif: heap frees:            0
+Massif: ignored heap allocs:   ...
+Massif: ignored heap frees:    ...
+Massif: ignored heap reallocs: ...
+Massif: stack allocs:          0
+Massif: stack frees:           0
 Massif: XPts:                 ...
 Massif: top-XPts:             ...
 Massif: XPt init expansions:  ...
 Massif: XPt later expansions: ...
 Massif: SXPt allocs:          ...
 Massif: SXPt frees:           ...
-Massif: skipped snapshots:    0
-Massif: real snapshots:       11
-Massif: detailed snapshots:   1
-Massif: peak snapshots:       0
-Massif: cullings:             0
+Massif: skipped snapshots:     0
+Massif: real snapshots:        11
+Massif: detailed snapshots:    1
+Massif: peak snapshots:        0
+Massif: cullings:              0
 Massif: XCon redos:           ...
diff --git a/massif/tests/deep-B.vgtest b/massif/tests/deep-B.vgtest
index 46c305e..f6e390d 100644
--- a/massif/tests/deep-B.vgtest
+++ b/massif/tests/deep-B.vgtest
@@ -1,5 +1,6 @@
 prog: deep
 vgopts: --stacks=no --time-unit=B --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 -v -v --depth=8 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 stderr_filter: filter_verbose
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/deep-C.post.exp b/massif/tests/deep-C.post.exp
index 59f6ea3..c36054e 100644
--- a/massif/tests/deep-C.post.exp
+++ b/massif/tests/deep-C.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./deep
-Massif arguments:   --stacks=no --time-unit=B --alloc-fn=a3 --alloc-fn=a4 --alloc-fn=a5 --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 --depth=8 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --alloc-fn=a3 --alloc-fn=a4 --alloc-fn=a5 --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 --depth=8 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/deep-C.stderr.exp b/massif/tests/deep-C.stderr.exp
index 457d170..3577914 100644
--- a/massif/tests/deep-C.stderr.exp
+++ b/massif/tests/deep-C.stderr.exp
@@ -23,6 +23,11 @@
 Massif:   21: a10
 Massif:   22: a11
 Massif:   23: a12
+Massif: ignore-fns:
+Massif:   0: __part_load_locale
+Massif:   1: __time_load_locale
+Massif:   2: dwarf2_unwind_dyld_add_image_hook
+Massif:   3: get_or_create_key_element
 Massif: startup S.  0 (t:0, hp:0, ex:0, st:0)
 Massif:   alloc S.  1 (t:408, hp:400, ex:8, st:0)
 Massif:   alloc S.  2 (t:816, hp:800, ex:16, st:0)
@@ -34,20 +39,23 @@
 Massif:   alloc S.  8 (t:3264, hp:3200, ex:64, st:0)
 Massif:   alloc Sd  9 (t:3672, hp:3600, ex:72, st:0)
 Massif:   alloc S. 10 (t:4080, hp:4000, ex:80, st:0)
-Massif: heap allocs:          10
-Massif: heap reallocs:        0
-Massif: heap frees:           0
-Massif: stack allocs:         0
-Massif: stack frees:          0
+Massif: heap allocs:           10
+Massif: heap reallocs:         0
+Massif: heap frees:            0
+Massif: ignored heap allocs:   ...
+Massif: ignored heap frees:    ...
+Massif: ignored heap reallocs: ...
+Massif: stack allocs:          0
+Massif: stack frees:           0
 Massif: XPts:                 ...
 Massif: top-XPts:             ...
 Massif: XPt init expansions:  ...
 Massif: XPt later expansions: ...
 Massif: SXPt allocs:          ...
 Massif: SXPt frees:           ...
-Massif: skipped snapshots:    0
-Massif: real snapshots:       11
-Massif: detailed snapshots:   1
-Massif: peak snapshots:       0
-Massif: cullings:             0
+Massif: skipped snapshots:     0
+Massif: real snapshots:        11
+Massif: detailed snapshots:    1
+Massif: peak snapshots:        0
+Massif: cullings:              0
 Massif: XCon redos:           ...
diff --git a/massif/tests/deep-C.vgtest b/massif/tests/deep-C.vgtest
index 9cda9ed..b40ba36 100644
--- a/massif/tests/deep-C.vgtest
+++ b/massif/tests/deep-C.vgtest
@@ -1,5 +1,6 @@
 prog: deep
 vgopts: --stacks=no --time-unit=B --alloc-fn=a3 --alloc-fn=a4 --alloc-fn=a5 --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 -v -v --depth=8 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 stderr_filter: filter_verbose
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/deep-D.post.exp b/massif/tests/deep-D.post.exp
index 78ea7c2..cdecf89 100644
--- a/massif/tests/deep-D.post.exp
+++ b/massif/tests/deep-D.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./deep
-Massif arguments:   --stacks=no --time-unit=B --alloc-fn=a1 --alloc-fn=a2 --alloc-fn=a3 --alloc-fn=a4 --alloc-fn=a5 --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 --alloc-fn=main --depth=20 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --alloc-fn=a1 --alloc-fn=a2 --alloc-fn=a3 --alloc-fn=a4 --alloc-fn=a5 --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 --alloc-fn=main --depth=20 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/deep-D.vgtest b/massif/tests/deep-D.vgtest
index 27b92ad..7e10dbf 100644
--- a/massif/tests/deep-D.vgtest
+++ b/massif/tests/deep-D.vgtest
@@ -1,4 +1,5 @@
 prog: deep
 vgopts: --stacks=no --time-unit=B --alloc-fn=a1 --alloc-fn=a2 --alloc-fn=a3 --alloc-fn=a4 --alloc-fn=a5 --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 --alloc-fn=main --depth=20 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses | ../../tests/filter_libc
 cleanup: rm massif.out
diff --git a/massif/tests/filter_verbose b/massif/tests/filter_verbose
index e972c69..5f159c3 100755
--- a/massif/tests/filter_verbose
+++ b/massif/tests/filter_verbose
@@ -11,6 +11,11 @@
 # lines by default, and the 'p' means do print those that match the pattern.
 sed -n "/Massif:/p" |
 
+# These ignored heap counts could vary from machine to machine.
+sed "s/\(Massif: ignored heap allocs:\).*/\1   .../" |
+sed "s/\(Massif: ignored heap frees:\).*/\1    .../" |
+sed "s/\(Massif: ignored heap reallocs:\).*/\1 .../" |
+
 # These XPt counts vary from machine to machine, because the size of the
 # stack trace can vary -- eg. some machines have more stack frames below
 # zero than other machines.  So filter them out.
diff --git a/massif/tests/ignored.c b/massif/tests/ignored.c
new file mode 100644
index 0000000..be16f69
--- /dev/null
+++ b/massif/tests/ignored.c
@@ -0,0 +1,49 @@
+#include <stdlib.h>
+
+// All sizes are divisible by 16 -- no slop.
+
+int* ignore1(void)
+{
+   // Allocating/freeing in an ignored function: ignored.
+   int* ignored_x1 = malloc(400);
+   int* ignored_x2 = malloc(400);
+   free(ignored_x2);
+   return ignored_x1;
+}
+
+void ignore2(int* x, int* ignored_x)
+{
+   // Growing/shrinking a non-ignored block in an ignored function: ignored.
+   x = realloc(x, 800);   
+   x = realloc(x, 400);   
+
+   // Growing/shrinking an ignored block in an ignored function: ignored.
+   ignored_x = realloc(ignored_x, 800);   
+   ignored_x = realloc(ignored_x, 400);   
+}
+
+int main(void)
+{
+   int* x;
+   int* ignored_x;
+
+   // Not ignored.
+   x = malloc(400);
+
+   // Get an ignored block.
+   ignored_x = ignore1();
+
+   // Growing/shrinking a non-ignored block in a non-ignored function:
+   // not ignored.
+   x = realloc(x, 800);
+   x = realloc(x, 400);
+
+   // Growing/shrinking an ignored block in a non-ignored function: ignored.
+   ignored_x = realloc(ignored_x, 800);
+   ignored_x = realloc(ignored_x, 400);
+
+   ignore2(x, ignored_x);
+
+   x = realloc(ignored_x, 0);    // equivalent to 'free(ignored_x)'.
+}
+
diff --git a/massif/tests/ignored.post.exp b/massif/tests/ignored.post.exp
new file mode 100644
index 0000000..b1e3492
--- /dev/null
+++ b/massif/tests/ignored.post.exp
@@ -0,0 +1,50 @@
+--------------------------------------------------------------------------------
+Command:            ./ignored
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out --ignore-fn=ignore1 --ignore-fn=ignore2 --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
+ms_print arguments: massif.out
+--------------------------------------------------------------------------------
+
+
+     B
+  800^                                                                       #
+     |                                                                       #
+     |                                                                       #
+     |                                                                       #
+     |                                                                       #
+     |                                                                       #
+     |                                                                       #
+     |                                                                       #
+     |                                                                       #
+     |                                                                       #
+     |                                    :                                  #
+     |                                    :                                  #
+     |                                    :                                  #
+     |                                    :                                  #
+     |                                    :                                  #
+     |                                    :                                  #
+     |                                    :                                  #
+     |                                    :                                  #
+     |                                    :                                  #
+     |                                    :                                  #
+   0 +----------------------------------------------------------------------->B
+     0                                                                     800
+
+Number of snapshots: 5
+ Detailed snapshots: [3 (peak)]
+
+--------------------------------------------------------------------------------
+  n        time(B)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
+--------------------------------------------------------------------------------
+  0              0                0                0             0            0
+  1            400              400              400             0            0
+  2            800              800              800             0            0
+  3            800              800              800             0            0
+100.00% (800B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
+->100.00% (800B) 0x........: main (ignored.c:38)
+| 
+->00.00% (0B) in 1+ places, all below ms_print's threshold (01.00%)
+
+--------------------------------------------------------------------------------
+  n        time(B)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
+--------------------------------------------------------------------------------
+  4            800              800              400           400            0
diff --git a/massif/tests/ignored.stderr.exp b/massif/tests/ignored.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/massif/tests/ignored.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/massif/tests/ignored.vgtest b/massif/tests/ignored.vgtest
new file mode 100644
index 0000000..fed7c26
--- /dev/null
+++ b/massif/tests/ignored.vgtest
@@ -0,0 +1,6 @@
+prog: ignored
+vgopts: --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out
+vgopts: --ignore-fn=ignore1 --ignore-fn=ignore2
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
+post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
+cleanup: rm massif.out
diff --git a/massif/tests/ignoring.post.exp b/massif/tests/ignoring.post.exp
index efe7c09..04eaf84 100644
--- a/massif/tests/ignoring.post.exp
+++ b/massif/tests/ignoring.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./ignoring
-Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/ignoring.vgtest b/massif/tests/ignoring.vgtest
index 0a22e40..9bcb8bd 100644
--- a/massif/tests/ignoring.vgtest
+++ b/massif/tests/ignoring.vgtest
@@ -1,4 +1,5 @@
 prog: ignoring
 vgopts: --stacks=no --time-unit=B --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/insig.post.exp b/massif/tests/insig.post.exp
index 177dcf9..3c187ea 100644
--- a/massif/tests/insig.post.exp
+++ b/massif/tests/insig.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./insig
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=128 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=128 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/insig.vgtest b/massif/tests/insig.vgtest
index 16857af..cb167df 100644
--- a/massif/tests/insig.vgtest
+++ b/massif/tests/insig.vgtest
@@ -1,4 +1,5 @@
 prog: insig
 vgopts: --stacks=no --time-unit=B --heap-admin=128 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/long-names.post.exp b/massif/tests/long-names.post.exp
index a425c0e..1a5dc37 100644
--- a/massif/tests/long-names.post.exp
+++ b/massif/tests/long-names.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./long-names
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out --detailed-freq=3
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out --detailed-freq=3 --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/long-names.vgtest b/massif/tests/long-names.vgtest
index f071366..38d8d6d 100644
--- a/massif/tests/long-names.vgtest
+++ b/massif/tests/long-names.vgtest
@@ -1,4 +1,5 @@
 prog: long-names
 vgopts: --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out --detailed-freq=3
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/long-time.post.exp b/massif/tests/long-time.post.exp
index 79f4e3d..1388d28 100644
--- a/massif/tests/long-time.post.exp
+++ b/massif/tests/long-time.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./long-time
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/long-time.vgtest b/massif/tests/long-time.vgtest
index 83757ee..5c80658 100644
--- a/massif/tests/long-time.vgtest
+++ b/massif/tests/long-time.vgtest
@@ -1,4 +1,5 @@
 prog: long-time
 vgopts: --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/new-cpp.post.exp b/massif/tests/new-cpp.post.exp
index fec6638..dd33ddf 100644
--- a/massif/tests/new-cpp.post.exp
+++ b/massif/tests/new-cpp.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./new-cpp
-Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/new-cpp.vgtest b/massif/tests/new-cpp.vgtest
index 72471d4..df2d3aa 100644
--- a/massif/tests/new-cpp.vgtest
+++ b/massif/tests/new-cpp.vgtest
@@ -1,4 +1,5 @@
 prog: new-cpp
 vgopts: --stacks=no --time-unit=B --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/no-stack-no-heap.post.exp b/massif/tests/no-stack-no-heap.post.exp
index b8caf84..1f3d27e 100644
--- a/massif/tests/no-stack-no-heap.post.exp
+++ b/massif/tests/no-stack-no-heap.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./basic
-Massif arguments:   --stacks=no --heap=no --time-unit=B --massif-out-file=massif.out
+Massif arguments:   --stacks=no --heap=no --time-unit=B --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/no-stack-no-heap.vgtest b/massif/tests/no-stack-no-heap.vgtest
index 17308b1..b984fc0 100644
--- a/massif/tests/no-stack-no-heap.vgtest
+++ b/massif/tests/no-stack-no-heap.vgtest
@@ -1,4 +1,5 @@
 prog: basic
 vgopts: --stacks=no --heap=no --time-unit=B --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/null.post.exp b/massif/tests/null.post.exp
index b02f5e7..e81091a 100644
--- a/massif/tests/null.post.exp
+++ b/massif/tests/null.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./null
-Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/null.vgtest b/massif/tests/null.vgtest
index 72ac65c..5063f8e 100644
--- a/massif/tests/null.vgtest
+++ b/massif/tests/null.vgtest
@@ -1,4 +1,5 @@
 prog: null
 vgopts: --stacks=no --time-unit=B --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/one.post.exp b/massif/tests/one.post.exp
index 6b7fec2..989c85d 100644
--- a/massif/tests/one.post.exp
+++ b/massif/tests/one.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./one
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/one.vgtest b/massif/tests/one.vgtest
index 38e0f7f..9a15467 100644
--- a/massif/tests/one.vgtest
+++ b/massif/tests/one.vgtest
@@ -1,4 +1,5 @@
 prog: one
 vgopts: --stacks=no --time-unit=B --heap-admin=0 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/overloaded-new.post.exp b/massif/tests/overloaded-new.post.exp
index fdae022..698dc8e 100644
--- a/massif/tests/overloaded-new.post.exp
+++ b/massif/tests/overloaded-new.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./overloaded-new
-Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/overloaded-new.vgtest b/massif/tests/overloaded-new.vgtest
index 50d2ad0..b35673b 100644
--- a/massif/tests/overloaded-new.vgtest
+++ b/massif/tests/overloaded-new.vgtest
@@ -1,4 +1,5 @@
 prog: overloaded-new
 vgopts: --stacks=no --time-unit=B --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/peak.post.exp b/massif/tests/peak.post.exp
index ad7afae..1cbb8b4 100644
--- a/massif/tests/peak.post.exp
+++ b/massif/tests/peak.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./peak
-Massif arguments:   --stacks=no --time-unit=B --peak-inaccuracy=0 --heap-admin=128 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --peak-inaccuracy=0 --heap-admin=128 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/peak.vgtest b/massif/tests/peak.vgtest
index f30efe8..5cc2255 100644
--- a/massif/tests/peak.vgtest
+++ b/massif/tests/peak.vgtest
@@ -1,4 +1,5 @@
 prog: peak
 vgopts: --stacks=no --time-unit=B --peak-inaccuracy=0 --heap-admin=128 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/peak2.post.exp b/massif/tests/peak2.post.exp
index af8946d..2dd1275 100644
--- a/massif/tests/peak2.post.exp
+++ b/massif/tests/peak2.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./peak
-Massif arguments:   --stacks=no --time-unit=B --peak-inaccuracy=10.0 --heap-admin=128 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --peak-inaccuracy=10.0 --heap-admin=128 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/peak2.stderr.exp b/massif/tests/peak2.stderr.exp
index fd1b972..39527b0 100644
--- a/massif/tests/peak2.stderr.exp
+++ b/massif/tests/peak2.stderr.exp
@@ -13,6 +13,11 @@
 Massif:   11: operator new[](unsigned, std::nothrow_t const&)
 Massif:   12: operator new(unsigned long, std::nothrow_t const&)
 Massif:   13: operator new[](unsigned long, std::nothrow_t const&)
+Massif: ignore-fns:
+Massif:   0: __part_load_locale
+Massif:   1: __time_load_locale
+Massif:   2: dwarf2_unwind_dyld_add_image_hook
+Massif:   3: get_or_create_key_element
 Massif: startup S.  0 (t:0, hp:0, ex:0, st:0)
 Massif:   alloc S.  1 (t:1728, hp:1600, ex:128, st:0)
 Massif:   alloc S.  2 (t:1872, hp:1616, ex:256, st:0)
@@ -89,20 +94,23 @@
 Massif:   alloc S. 73 (t:40176, hp:32016, ex:2688, st:0)
 Massif: de-PEAK Sp 74 (t:40176, hp:32016, ex:2688, st:0)
 Massif: dealloc S. 75 (t:40320, hp:32000, ex:2560, st:0)
-Massif: heap allocs:          40
-Massif: heap reallocs:        0
-Massif: heap frees:           20
-Massif: stack allocs:         0
-Massif: stack frees:          0
+Massif: heap allocs:           40
+Massif: heap reallocs:         0
+Massif: heap frees:            20
+Massif: ignored heap allocs:   ...
+Massif: ignored heap frees:    ...
+Massif: ignored heap reallocs: ...
+Massif: stack allocs:          0
+Massif: stack frees:           0
 Massif: XPts:                 ...
 Massif: top-XPts:             ...
 Massif: XPt init expansions:  ...
 Massif: XPt later expansions: ...
 Massif: SXPt allocs:          ...
 Massif: SXPt frees:           ...
-Massif: skipped snapshots:    0
-Massif: real snapshots:       76
-Massif: detailed snapshots:   15
-Massif: peak snapshots:       15
-Massif: cullings:             0
+Massif: skipped snapshots:     0
+Massif: real snapshots:        76
+Massif: detailed snapshots:    15
+Massif: peak snapshots:        15
+Massif: cullings:              0
 Massif: XCon redos:           ...
diff --git a/massif/tests/peak2.vgtest b/massif/tests/peak2.vgtest
index 0ea5926..91a6e49 100644
--- a/massif/tests/peak2.vgtest
+++ b/massif/tests/peak2.vgtest
@@ -1,5 +1,6 @@
 prog: peak
 vgopts: --stacks=no --time-unit=B -v -v --peak-inaccuracy=10.0 --heap-admin=128 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 stderr_filter: filter_verbose
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/realloc.post.exp b/massif/tests/realloc.post.exp
index 3dd24d5..3298d7d 100644
--- a/massif/tests/realloc.post.exp
+++ b/massif/tests/realloc.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./realloc
-Massif arguments:   --stacks=no --heap-admin=0 --time-unit=B --threshold=0 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --heap-admin=0 --time-unit=B --threshold=0 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: --threshold=0 massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/realloc.stderr.exp b/massif/tests/realloc.stderr.exp
index f802dd5..d8fcf7e 100644
--- a/massif/tests/realloc.stderr.exp
+++ b/massif/tests/realloc.stderr.exp
@@ -13,6 +13,11 @@
 Massif:   11: operator new[](unsigned, std::nothrow_t const&)
 Massif:   12: operator new(unsigned long, std::nothrow_t const&)
 Massif:   13: operator new[](unsigned long, std::nothrow_t const&)
+Massif: ignore-fns:
+Massif:   0: __part_load_locale
+Massif:   1: __time_load_locale
+Massif:   2: dwarf2_unwind_dyld_add_image_hook
+Massif:   3: get_or_create_key_element
 Massif: startup S.  0 (t:0, hp:0, ex:0, st:0)
 Massif:   alloc S.  1 (t:800, hp:800, ex:0, st:0)
 Massif: realloc S.  2 (t:800, hp:800, ex:0, st:0)
@@ -21,20 +26,23 @@
 Massif: realloc S.  5 (t:1200, hp:1200, ex:0, st:0)
 Massif: de-PEAK Sp  6 (t:1200, hp:1200, ex:0, st:0)
 Massif: dealloc S.  7 (t:2400, hp:0, ex:0, st:0)
-Massif: heap allocs:          1
-Massif: heap reallocs:        3
-Massif: heap frees:           1
-Massif: stack allocs:         0
-Massif: stack frees:          0
+Massif: heap allocs:           1
+Massif: heap reallocs:         3
+Massif: heap frees:            1
+Massif: ignored heap allocs:   ...
+Massif: ignored heap frees:    ...
+Massif: ignored heap reallocs: ...
+Massif: stack allocs:          0
+Massif: stack frees:           0
 Massif: XPts:                 ...
 Massif: top-XPts:             ...
 Massif: XPt init expansions:  ...
 Massif: XPt later expansions: ...
 Massif: SXPt allocs:          ...
 Massif: SXPt frees:           ...
-Massif: skipped snapshots:    0
-Massif: real snapshots:       8
-Massif: detailed snapshots:   2
-Massif: peak snapshots:       2
-Massif: cullings:             0
+Massif: skipped snapshots:     0
+Massif: real snapshots:        8
+Massif: detailed snapshots:    2
+Massif: peak snapshots:        2
+Massif: cullings:              0
 Massif: XCon redos:           ...
diff --git a/massif/tests/realloc.vgtest b/massif/tests/realloc.vgtest
index c50bad1..4344328 100644
--- a/massif/tests/realloc.vgtest
+++ b/massif/tests/realloc.vgtest
@@ -1,5 +1,6 @@
 prog: realloc
 vgopts: -v -v --stacks=no --heap-admin=0 --time-unit=B --threshold=0 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 stderr_filter: filter_verbose
 post: perl ../../massif/ms_print --threshold=0 massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/thresholds_0_0.post.exp b/massif/tests/thresholds_0_0.post.exp
index 5bdcc59..0d1b86e 100644
--- a/massif/tests/thresholds_0_0.post.exp
+++ b/massif/tests/thresholds_0_0.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./thresholds
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=0 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=0 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out --threshold=0
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/thresholds_0_0.vgtest b/massif/tests/thresholds_0_0.vgtest
index 5b9f7c6..f848c3e 100644
--- a/massif/tests/thresholds_0_0.vgtest
+++ b/massif/tests/thresholds_0_0.vgtest
@@ -1,4 +1,5 @@
 prog: thresholds
 vgopts: --stacks=no --time-unit=B --heap-admin=0 --threshold=0 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out --threshold=0 | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/thresholds_0_10.post.exp b/massif/tests/thresholds_0_10.post.exp
index 9d9b3e4..cefc5d0 100644
--- a/massif/tests/thresholds_0_10.post.exp
+++ b/massif/tests/thresholds_0_10.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./thresholds
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=0 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=0 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out --threshold=10
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/thresholds_0_10.vgtest b/massif/tests/thresholds_0_10.vgtest
index 58f2a94..bca3108 100644
--- a/massif/tests/thresholds_0_10.vgtest
+++ b/massif/tests/thresholds_0_10.vgtest
@@ -1,4 +1,5 @@
 prog: thresholds
 vgopts: --stacks=no --time-unit=B --heap-admin=0 --threshold=0 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out --threshold=10 | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/thresholds_10_0.post.exp b/massif/tests/thresholds_10_0.post.exp
index e5823f8..981f08c 100644
--- a/massif/tests/thresholds_10_0.post.exp
+++ b/massif/tests/thresholds_10_0.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./thresholds
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=10 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=10 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out --threshold=0
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/thresholds_10_0.vgtest b/massif/tests/thresholds_10_0.vgtest
index 8c9dd13..cc8f09a 100644
--- a/massif/tests/thresholds_10_0.vgtest
+++ b/massif/tests/thresholds_10_0.vgtest
@@ -1,4 +1,5 @@
 prog: thresholds
 vgopts: --stacks=no --time-unit=B --heap-admin=0 --threshold=10 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out --threshold=0 | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/thresholds_10_10.post.exp b/massif/tests/thresholds_10_10.post.exp
index 1374375..948b71f 100644
--- a/massif/tests/thresholds_10_10.post.exp
+++ b/massif/tests/thresholds_10_10.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./thresholds
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=10 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=10 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out --threshold=10
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/thresholds_10_10.vgtest b/massif/tests/thresholds_10_10.vgtest
index 0b9083b..5dd3729 100644
--- a/massif/tests/thresholds_10_10.vgtest
+++ b/massif/tests/thresholds_10_10.vgtest
@@ -1,4 +1,5 @@
 prog: thresholds
 vgopts: --stacks=no --time-unit=B --heap-admin=0 --threshold=10 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out --threshold=10 | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/thresholds_5_0.post.exp b/massif/tests/thresholds_5_0.post.exp
index 911225d..7da2416 100644
--- a/massif/tests/thresholds_5_0.post.exp
+++ b/massif/tests/thresholds_5_0.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./thresholds
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=5 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=5 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out --threshold=0
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/thresholds_5_0.vgtest b/massif/tests/thresholds_5_0.vgtest
index cb5f445..08500c2 100644
--- a/massif/tests/thresholds_5_0.vgtest
+++ b/massif/tests/thresholds_5_0.vgtest
@@ -1,4 +1,5 @@
 prog: thresholds
 vgopts: --stacks=no --time-unit=B --heap-admin=0 --threshold=5 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out --threshold=0 | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/thresholds_5_10.post.exp b/massif/tests/thresholds_5_10.post.exp
index 4be87b1..ee79ee3 100644
--- a/massif/tests/thresholds_5_10.post.exp
+++ b/massif/tests/thresholds_5_10.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./thresholds
-Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=5 --massif-out-file=massif.out
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=5 --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out --threshold=10
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/thresholds_5_10.vgtest b/massif/tests/thresholds_5_10.vgtest
index 86a0781..4a61ba8 100644
--- a/massif/tests/thresholds_5_10.vgtest
+++ b/massif/tests/thresholds_5_10.vgtest
@@ -1,4 +1,5 @@
 prog: thresholds
 vgopts: --stacks=no --time-unit=B --heap-admin=0 --threshold=5 --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out --threshold=10 | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/zero1.post.exp b/massif/tests/zero1.post.exp
index faffb80..db640cb 100644
--- a/massif/tests/zero1.post.exp
+++ b/massif/tests/zero1.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./zero
-Massif arguments:   --stacks=no --heap-admin=0 --time-unit=B --massif-out-file=massif.out
+Massif arguments:   --stacks=no --heap-admin=0 --time-unit=B --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: --threshold=0 massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/zero1.vgtest b/massif/tests/zero1.vgtest
index 95641db..56835e8 100644
--- a/massif/tests/zero1.vgtest
+++ b/massif/tests/zero1.vgtest
@@ -1,4 +1,5 @@
 prog: zero
 vgopts: --stacks=no --heap-admin=0 --time-unit=B --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print --threshold=0 massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/massif/tests/zero2.post.exp b/massif/tests/zero2.post.exp
index 75d8e7d..1a8b5ae 100644
--- a/massif/tests/zero2.post.exp
+++ b/massif/tests/zero2.post.exp
@@ -1,6 +1,6 @@
 --------------------------------------------------------------------------------
 Command:            ./zero
-Massif arguments:   --stacks=no --heap-admin=0 --time-unit=B --massif-out-file=massif.out
+Massif arguments:   --stacks=no --heap-admin=0 --time-unit=B --massif-out-file=massif.out --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 ms_print arguments: massif.out
 --------------------------------------------------------------------------------
 
diff --git a/massif/tests/zero2.vgtest b/massif/tests/zero2.vgtest
index 0549a5a..8c42224 100644
--- a/massif/tests/zero2.vgtest
+++ b/massif/tests/zero2.vgtest
@@ -1,4 +1,5 @@
 prog: zero
 vgopts: --stacks=no --heap-admin=0 --time-unit=B --massif-out-file=massif.out
+vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
 cleanup: rm massif.out
diff --git a/tests/vg_regtest.in b/tests/vg_regtest.in
index 8bcb050..15c53f1 100755
--- a/tests/vg_regtest.in
+++ b/tests/vg_regtest.in
@@ -51,7 +51,8 @@
 # following lines, in any order:
 #   - prog:   <prog to run>                         (compulsory)
 #   - args:   <args for prog>                       (default: none)
-#   - vgopts: <Valgrind options>                    (default: none)
+#   - vgopts: <Valgrind options>                    (default: none;
+#                                                    multiple are allowed)
 #   - stdout_filter: <filter to run stdout through> (default: none)
 #   - stderr_filter: <filter to run stderr through> (default: ./filter_stderr)
 #   - prereq: <prerequisite command>                (default: none)
@@ -216,7 +217,7 @@
         if      ($line =~ /^\s*#/ || $line =~ /^\s*$/) {
 	    next;
 	} elsif ($line =~ /^\s*vgopts:\s*(.*)$/) {
-            $vgopts = $1;
+            $vgopts = $vgopts . " " . $1;   # Nb: Make sure there's a space!
         } elsif ($line =~ /^\s*prog:\s*(.*)$/) {
             $prog = validate_program(".", $1, 0, 0);
         } elsif ($line =~ /^\s*args:\s*(.*)$/) {