//===-- sanitizer_allocator_secondary.h -------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Part of the Sanitizer Allocator. // //===----------------------------------------------------------------------===// #ifndef SANITIZER_ALLOCATOR_H #error This file must be included inside sanitizer_allocator.h #endif // Fixed array to store LargeMmapAllocator chunks list, limited to 32K total // allocated chunks. To be used in memory constrained or not memory hungry cases // (currently, 32 bits and internal allocator). class LargeMmapAllocatorPtrArrayStatic { … }; // Much less restricted LargeMmapAllocator chunks list (comparing to // PtrArrayStatic). Backed by mmaped memory region and can hold up to 1M chunks. // ReservedAddressRange was used instead of just MAP_NORESERVE to achieve the // same functionality in Fuchsia case, which does not support MAP_NORESERVE. class LargeMmapAllocatorPtrArrayDynamic { … }; #if SANITIZER_WORDSIZE == 32 typedef LargeMmapAllocatorPtrArrayStatic DefaultLargeMmapAllocatorPtrArray; #else DefaultLargeMmapAllocatorPtrArray; #endif // This class can (de)allocate only large chunks of memory using mmap/unmap. // The main purpose of this allocator is to cover large and rare allocation // sizes not covered by more efficient allocators (e.g. SizeClassAllocator64). template <class MapUnmapCallback = NoOpMapUnmapCallback, class PtrArrayT = DefaultLargeMmapAllocatorPtrArray, class AddressSpaceViewTy = LocalAddressSpaceView> class LargeMmapAllocator { … };