Skip to content

Commit 54fe7ef

Browse files
authored
[compiler-rt][lsan][Fuchsia] Adjust lsan allocator settings (#69401)
These now match the settings for the asan allocator on Fuchsia+RISCV.
1 parent 9efaff1 commit 54fe7ef

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

compiler-rt/lib/lsan/lsan_allocator.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,23 @@ using PrimaryAllocator = PrimaryAllocatorASVT<LocalAddressSpaceView>;
6868
#else
6969
# if SANITIZER_FUCHSIA || defined(__powerpc64__)
7070
const uptr kAllocatorSpace = ~(uptr)0;
71+
# if SANITIZER_RISCV64
72+
// See the comments in compiler-rt/lib/asan/asan_allocator.h for why these
73+
// values were chosen.
74+
const uptr kAllocatorSize = UINT64_C(1) << 33; // 8GB
75+
using LSanSizeClassMap = SizeClassMap</*kNumBits=*/2,
76+
/*kMinSizeLog=*/5,
77+
/*kMidSizeLog=*/8,
78+
/*kMaxSizeLog=*/18,
79+
/*kNumCachedHintT=*/8,
80+
/*kMaxBytesCachedLog=*/10>;
81+
static_assert(LSanSizeClassMap::kNumClassesRounded <= 32,
82+
"32 size classes is the optimal number to ensure tests run "
83+
"effieciently on Fuchsia.");
84+
# else
7185
const uptr kAllocatorSize = 0x40000000000ULL; // 4T.
7286
using LSanSizeClassMap = DefaultSizeClassMap;
87+
# endif
7388
# elif SANITIZER_RISCV64
7489
const uptr kAllocatorSpace = ~(uptr)0;
7590
const uptr kAllocatorSize = 0x2000000000ULL; // 128G.

0 commit comments

Comments
 (0)