The combined scudo allocator object is over 4MB in size which gets created via the posix_memalign on every test run. If the tests are sanitized with asan, then the asan allocator will need to mmap this large object every single time a test is run. Depending on where this is mapped, we might not be able to find a large enough contiguous space for scudo's primary allocator to reserve an arena. Such a case is more likely to occur on 39-bit vma for RISCV where the arena size is roughly a quarter of the whole address space and fragmentation can be a big issue.
This helps reduce fragmentation by instead placing the allocator instance in a global storage rather than doing an anonymous mmap.
This should be enclosed by
#if SCUDO_CAN_USE_PRIMARY64 sizeof(scudo::Allocator<scudo::FuchsiaConfig>), #endifIdeally we want this to be used without conditional compilation. I'll be working on that later.
Also suggested a code move down below so that we won't have unused variable warning on non-RISCV64 path