aboutsummaryrefslogtreecommitdiff
path: root/contrib/compiler-rt/lib/lsan/lsan_common_mac.cc
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/compiler-rt/lib/lsan/lsan_common_mac.cc')
-rw-r--r--contrib/compiler-rt/lib/lsan/lsan_common_mac.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/compiler-rt/lib/lsan/lsan_common_mac.cc b/contrib/compiler-rt/lib/lsan/lsan_common_mac.cc
index ac27c7af6e35..2508c1dbd873 100644
--- a/contrib/compiler-rt/lib/lsan/lsan_common_mac.cc
+++ b/contrib/compiler-rt/lib/lsan/lsan_common_mac.cc
@@ -24,6 +24,13 @@
#include <mach/mach.h>
+// Only introduced in Mac OS X 10.9.
+#ifdef VM_MEMORY_OS_ALLOC_ONCE
+static const int kSanitizerVmMemoryOsAllocOnce = VM_MEMORY_OS_ALLOC_ONCE;
+#else
+static const int kSanitizerVmMemoryOsAllocOnce = 73;
+#endif
+
namespace __lsan {
typedef struct {
@@ -112,7 +119,8 @@ void ProcessGlobalRegions(Frontier *frontier) {
for (auto name : kSkippedSecNames) CHECK(ARRAY_SIZE(name) < kMaxSegName);
MemoryMappingLayout memory_mapping(false);
- InternalMmapVector<LoadedModule> modules(/*initial_capacity*/ 128);
+ InternalMmapVector<LoadedModule> modules;
+ modules.reserve(128);
memory_mapping.DumpListOfModules(&modules);
for (uptr i = 0; i < modules.size(); ++i) {
// Even when global scanning is disabled, we still need to scan
@@ -157,7 +165,7 @@ void ProcessPlatformSpecificAllocations(Frontier *frontier) {
// libxpc stashes some pointers in the Kernel Alloc Once page,
// make sure not to report those as leaks.
- if (info.user_tag == VM_MEMORY_OS_ALLOC_ONCE) {
+ if (info.user_tag == kSanitizerVmMemoryOsAllocOnce) {
ScanRangeForPointers(address, end_address, frontier, "GLOBAL",
kReachable);