summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2012-12-25 07:50:35 +0000
committerKostya Serebryany <kcc@google.com>2012-12-25 07:50:35 +0000
commitad24c58e1623db4bd8743c33b633b27b5f209b37 (patch)
treec286d3a1e0ffc73564bc64006daee71edd80071c /compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
parent774defc6499939a89559aaea3eadc71c458ea70f (diff)
downloadbcm5719-llvm-ad24c58e1623db4bd8743c33b633b27b5f209b37.tar.gz
bcm5719-llvm-ad24c58e1623db4bd8743c33b633b27b5f209b37.zip
[sanitizer] increase the maximum size class of the fast allocator. This should save quite a bit of memory in tsan/msan (and later in asan). This also puts more stress on the large allocator. Add a couple of checks
llvm-svn: 171055
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_allocator.h')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_allocator.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
index 5eb830932f6..33d5a699952 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
@@ -153,7 +153,7 @@ class SizeClassMap {
}
};
-typedef SizeClassMap<21, 256, 16> DefaultSizeClassMap;
+typedef SizeClassMap<15, 256, 16> DefaultSizeClassMap;
typedef SizeClassMap<15, 64, 14> CompactSizeClassMap;
@@ -323,9 +323,9 @@ class SizeClassAllocator64 {
COMPILER_CHECK((kRegionSize) >= (1ULL << (SANITIZER_WORDSIZE / 2)));
// Populate the free list with at most this number of bytes at once
// or with one element if its size is greater.
- static const uptr kPopulateSize = 1 << 18;
+ static const uptr kPopulateSize = 1 << 15;
// Call mmap for user memory with at least this size.
- static const uptr kUserMapSize = 1 << 18;
+ static const uptr kUserMapSize = 1 << 15;
// Call mmap for metadata memory with at least this size.
static const uptr kMetaMapSize = 1 << 16;
@@ -715,6 +715,7 @@ class LargeMmapAllocator {
{
SpinMutexLock l(&mutex_);
uptr idx = n_chunks_++;
+ CHECK_LT(idx, kMaxNumChunks);
h->chunk_idx = idx;
chunks_[idx] = h;
}
@@ -757,6 +758,8 @@ class LargeMmapAllocator {
// At least page_size_/2 metadata bytes is available.
void *GetMetaData(void *p) {
+ // Too slow: CHECK_EQ(p, GetBlockBegin(p));
+ CHECK(IsAligned(reinterpret_cast<uptr>(p), page_size_));
return GetHeader(p) + 1;
}
OpenPOWER on IntegriCloud