[compiler-rt] r184554 - [lsan] Increase allocator space; minor fixes.
Sergey Matveev
earthdok at google.com
Fri Jun 21 08:10:21 PDT 2013
Author: smatveev
Date: Fri Jun 21 10:10:20 2013
New Revision: 184554
URL: http://llvm.org/viewvc/llvm-project?rev=184554&view=rev
Log:
[lsan] Increase allocator space; minor fixes.
Modified:
compiler-rt/trunk/lib/lsan/lsan_allocator.cc
compiler-rt/trunk/lib/lsan/lsan_common.cc
Modified: compiler-rt/trunk/lib/lsan/lsan_allocator.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_allocator.cc?rev=184554&r1=184553&r2=184554&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_allocator.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_allocator.cc Fri Jun 21 10:10:20 2013
@@ -22,11 +22,9 @@
namespace __lsan {
-static const uptr kMaxAllowedMallocSize =
- FIRST_32_SECOND_64(3UL << 30, 8UL << 30);
-
+static const uptr kMaxAllowedMallocSize = 8UL << 30;
static const uptr kAllocatorSpace = 0x600000000000ULL;
-static const uptr kAllocatorSize = 0x10000000000ULL; // 1T.
+static const uptr kAllocatorSize = 0x40000000000ULL; // 4T.
struct ChunkMetadata {
bool allocated : 8; // Must be first.
@@ -79,9 +77,8 @@ void *Allocate(const StackTrace &stack,
if (size == 0)
size = 1;
if (size > kMaxAllowedMallocSize) {
- Report("WARNING: LeakSanitizer failed to allocate %p bytes\n",
- (void*)size);
- return 0;
+ Report("WARNING: LeakSanitizer failed to allocate %zu bytes\n", size);
+ return 0;
}
void *p = allocator.Allocate(&cache, size, alignment, cleared);
RegisterAllocation(stack, p, size);
@@ -97,10 +94,9 @@ void *Reallocate(const StackTrace &stack
uptr alignment) {
RegisterDeallocation(p);
if (new_size > kMaxAllowedMallocSize) {
- Report("WARNING: LeakSanitizer failed to allocate %p bytes\n",
- (void*)new_size);
- allocator.Deallocate(&cache, p);
- return 0;
+ Report("WARNING: LeakSanitizer failed to allocate %zu bytes\n", new_size);
+ allocator.Deallocate(&cache, p);
+ return 0;
}
p = allocator.Reallocate(&cache, p, new_size, alignment);
RegisterAllocation(stack, p, new_size);
Modified: compiler-rt/trunk/lib/lsan/lsan_common.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.cc?rev=184554&r1=184553&r2=184554&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Fri Jun 21 10:10:20 2013
@@ -99,7 +99,7 @@ void ScanRangeForPointers(uptr begin, up
uptr pp = begin;
if (pp % alignment)
pp = pp + alignment - pp % alignment;
- for (; pp + sizeof(uptr) <= end; pp += alignment) {
+ for (; pp + sizeof(void *) <= end; pp += alignment) {
void *p = *reinterpret_cast<void**>(pp);
if (!CanBeAHeapPointer(reinterpret_cast<uptr>(p))) continue;
void *chunk = PointsIntoChunk(p);
@@ -110,7 +110,7 @@ void ScanRangeForPointers(uptr begin, up
if (m.tag() == kIgnored && tag != kReachable) continue;
m.set_tag(tag);
if (flags()->log_pointers)
- Report("%p: found %p pointing into chunk %p-%p of size %llu.\n", pp, p,
+ Report("%p: found %p pointing into chunk %p-%p of size %zu.\n", pp, p,
chunk, reinterpret_cast<uptr>(chunk) + m.requested_size(),
m.requested_size());
if (frontier)
@@ -278,7 +278,7 @@ void PrintLeakedCb::operator()(void *p)
LsanMetadata m(p);
if (!m.allocated()) return;
if (m.tag() == kDirectlyLeaked || m.tag() == kIndirectlyLeaked) {
- Printf("%s leaked %llu byte object at %p.\n",
+ Printf("%s leaked %zu byte object at %p.\n",
m.tag() == kDirectlyLeaked ? "Directly" : "Indirectly",
m.requested_size(), p);
}
@@ -370,15 +370,15 @@ void LeakReport::PrintLargest(uptr max_l
CHECK(leaks_.size() <= kMaxLeaksConsidered);
Printf("\n");
if (leaks_.size() == kMaxLeaksConsidered)
- Printf("Too many leaks! Only the first %llu leaks encountered will be "
+ Printf("Too many leaks! Only the first %zu leaks encountered will be "
"reported.\n",
kMaxLeaksConsidered);
if (max_leaks > 0 && max_leaks < leaks_.size())
- Printf("The %llu largest leak(s):\n", max_leaks);
+ Printf("The %zu largest leak(s):\n", max_leaks);
InternalSort(&leaks_, leaks_.size(), IsLarger);
max_leaks = max_leaks > 0 ? Min(max_leaks, leaks_.size()) : leaks_.size();
for (uptr i = 0; i < max_leaks; i++) {
- Printf("%s leak of %llu byte(s) in %llu object(s) allocated from:\n",
+ Printf("%s leak of %zu byte(s) in %zu object(s) allocated from:\n",
leaks_[i].is_directly_leaked ? "Direct" : "Indirect",
leaks_[i].total_size, leaks_[i].hit_count);
PrintStackTraceById(leaks_[i].stack_trace_id);
@@ -386,7 +386,7 @@ void LeakReport::PrintLargest(uptr max_l
}
if (max_leaks < leaks_.size()) {
uptr remaining = leaks_.size() - max_leaks;
- Printf("Omitting %llu more leak(s).\n", remaining);
+ Printf("Omitting %zu more leak(s).\n", remaining);
}
}
@@ -398,7 +398,7 @@ void LeakReport::PrintSummary() {
allocations += leaks_[i].hit_count;
}
Printf(
- "SUMMARY: LeakSanitizer: %llu byte(s) leaked in %llu allocation(s).\n\n",
+ "SUMMARY: LeakSanitizer: %zu byte(s) leaked in %zu allocation(s).\n\n",
bytes, allocations);
}
More information about the llvm-commits
mailing list