diff options
author | Maxim Ostapenko <m.ostapenko@samsung.com> | 2016-11-17 15:58:25 +0300 |
---|---|---|
committer | Ivan Baravy <i.baravy@samsung.com> | 2017-02-22 12:25:50 +0300 |
commit | ecb307f395b48cbb537071b8eb214626881a667a (patch) | |
tree | 080ae8ef0ecca8f57da72a91685d2b91e7b0de0d /libsanitizer | |
parent | a537400bca7d771aa402bb6c289459bab98ce12f (diff) | |
download | linaro-gcc-ecb307f395b48cbb537071b8eb214626881a667a.tar.gz linaro-gcc-ecb307f395b48cbb537071b8eb214626881a667a.tar.bz2 linaro-gcc-ecb307f395b48cbb537071b8eb214626881a667a.zip |
Make {A, L}San allocator more compact.
This change tries to reduce memory consumption of {A, L}Saned image by hacking
primary allocator internals:
* Reduce region size 2^20 -> 2^17.
* Make largest chunk size in primary allocator 2^17 -> 2^16.
The change appears to be quite useful for LSan'ed image:
Stock version:
total used free shared buffers cached
Mem: 964 828 136 3 4 92
Patched version:
total used free shared buffers cached
Mem: 964 688 275 5 13 185
Change-Id: I80b95f7dfb5a7be0e7208567a31606a3d027256c
Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
Diffstat (limited to 'libsanitizer')
-rw-r--r-- | libsanitizer/asan/asan_allocator.h | 2 | ||||
-rw-r--r-- | libsanitizer/lsan/lsan_allocator.cc | 2 | ||||
-rw-r--r-- | libsanitizer/sanitizer_common/sanitizer_allocator.h | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/libsanitizer/asan/asan_allocator.h b/libsanitizer/asan/asan_allocator.h index 921131ab4e9..6d9b7e4fa96 100644 --- a/libsanitizer/asan/asan_allocator.h +++ b/libsanitizer/asan/asan_allocator.h @@ -125,7 +125,7 @@ typedef DefaultSizeClassMap SizeClassMap; typedef SizeClassAllocator64<kAllocatorSpace, kAllocatorSize, 0 /*metadata*/, SizeClassMap, AsanMapUnmapCallback> PrimaryAllocator; #else // Fallback to SizeClassAllocator32. -static const uptr kRegionSizeLog = 20; +static const uptr kRegionSizeLog = 17; static const uptr kNumRegions = SANITIZER_MMAP_RANGE_SIZE >> kRegionSizeLog; # if SANITIZER_WORDSIZE == 32 typedef FlatByteMap<kNumRegions> ByteMap; diff --git a/libsanitizer/lsan/lsan_allocator.cc b/libsanitizer/lsan/lsan_allocator.cc index c3fd6aebf64..f0c6b0dfedd 100644 --- a/libsanitizer/lsan/lsan_allocator.cc +++ b/libsanitizer/lsan/lsan_allocator.cc @@ -56,7 +56,7 @@ typedef SizeClassAllocator64<kAllocatorSpace, kAllocatorSize, #endif #else // SANITIZER_WORDSIZE == 32 typedef CompactSizeClassMap SizeClassMap; -static const uptr kRegionSizeLog = 20; +static const uptr kRegionSizeLog = 17; static const uptr kNumRegions = SANITIZER_MMAP_RANGE_SIZE >> kRegionSizeLog; typedef FlatByteMap<kNumRegions> ByteMap; typedef SizeClassAllocator32<0, SANITIZER_MMAP_RANGE_SIZE, diff --git a/libsanitizer/sanitizer_common/sanitizer_allocator.h b/libsanitizer/sanitizer_common/sanitizer_allocator.h index 0490a3cf74d..45e32444d45 100644 --- a/libsanitizer/sanitizer_common/sanitizer_allocator.h +++ b/libsanitizer/sanitizer_common/sanitizer_allocator.h @@ -191,7 +191,7 @@ class SizeClassMap { }; typedef SizeClassMap<17, 128, 16> DefaultSizeClassMap; -typedef SizeClassMap<17, 64, 14> CompactSizeClassMap; +typedef SizeClassMap<16, 64, 14> CompactSizeClassMap; template<class SizeClassAllocator> struct SizeClassAllocatorLocalCache; // Memory allocator statistics |