[PATCH] D32966: Avoid unnecessary calls to vm_region_recurse

Francis Ricci via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 07:17:18 PDT 2017


fjricci created this revision.

This should significantly improve darwin lsan performance in cases where root regions are not used.


https://reviews.llvm.org/D32966

Files:
  lib/lsan/lsan_common_mac.cc


Index: lib/lsan/lsan_common_mac.cc
===================================================================
--- lib/lsan/lsan_common_mac.cc
+++ lib/lsan/lsan_common_mac.cc
@@ -144,6 +144,11 @@
     if (info.user_tag == VM_MEMORY_OS_ALLOC_ONCE) {
       ScanRangeForPointers(address, end_address, frontier, "GLOBAL",
                            kReachable);
+
+      // Recursing over the full memory map is very slow, break out
+      // early if we don't need the full iteration.
+      if (!flags()->use_root_regions || !root_regions->size())
+        break;
     }
 
     // This additional root region scan is required on Darwin in order to


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32966.98165.patch
Type: text/x-patch
Size: 640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170508/2d4ca21d/attachment.bin>


More information about the llvm-commits mailing list