template <typename Config>

class SizeClassAllocator32

Defined at line 45 of file ../../third_party/scudo/src/primary32.h

SizeClassAllocator32 is an allocator for 32 or 64-bit address space.

It maps Regions of 2^RegionSizeLog bytes aligned on a 2^RegionSizeLog bytes

boundary, and keeps a bytemap of the mappable address space to track the size

class they are associated with.

Mapped regions are split into equally sized Blocks according to the size

class they belong to, and the associated pointers are shuffled to prevent any

predictable address pattern (the predictability increases with the block

size).

Regions for size class 0 are special and used to hold Batches, which

allow to transfer arrays of pointers from the global size class freelist to

the thread specific freelist for said class, and back.

Memory used by this allocator is never unmapped but can be partially

reclaimed if the platform allows for it.

Public Members

AtomicOptions Options
static const uptr GroupSizeLog
static const u16 MaxNumBlocksInBatch

Public Methods

uptr getSizeOfBatchClass ()

Defined at line 64 of file ../../third_party/scudo/src/primary32.h

uptr getSizeByClassId (uptr ClassId)

Defined at line 72 of file ../../third_party/scudo/src/primary32.h

bool canAllocate (uptr Size)

Defined at line 78 of file ../../third_party/scudo/src/primary32.h

CompactPtrT compactPtr (uptr ClassId, uptr Ptr)

Defined at line 87 of file ../../third_party/scudo/src/primary32.h

void * decompactPtr (uptr ClassId, CompactPtrT CompactPtr)

Defined at line 90 of file ../../third_party/scudo/src/primary32.h

uptr compactPtrGroupBase (CompactPtrT CompactPtr)

Defined at line 93 of file ../../third_party/scudo/src/primary32.h

uptr decompactGroupBase (uptr CompactPtrGroupBase)

Defined at line 97 of file ../../third_party/scudo/src/primary32.h

bool isSmallBlock (uptr BlockSize)

Defined at line 100 of file ../../third_party/scudo/src/primary32.h

bool isLargeBlock (uptr BlockSize)

Defined at line 104 of file ../../third_party/scudo/src/primary32.h

void getMemoryGroupFragmentationInfo (ScopedString * Str)

Defined at line 123 of file ../../third_party/scudo/src/primary32.h

const char * getRegionInfoArrayAddress ()

Defined at line 134 of file ../../third_party/scudo/src/primary32.h

uptr getRegionInfoArraySize ()

Defined at line 135 of file ../../third_party/scudo/src/primary32.h

BlockInfo findNearestBlock (const char * RegionInfoData, uptr Ptr)

Not supported in SizeClassAllocator32.

Defined at line 138 of file ../../third_party/scudo/src/primary32.h

void init (s32 ReleaseToOsInterval)

Defined at line 238 of file ../../third_party/scudo/src/primary32.h

void unmapTestOnly ()

Defined at line 268 of file ../../third_party/scudo/src/primary32.h

void verifyAllBlocksAreReleasedTestOnly ()

When all blocks are freed, it has to be the same size as `AllocatedUser`.

Defined at line 295 of file ../../third_party/scudo/src/primary32.h

u16 popBlocks (SizeClassAllocatorT * SizeClassAllocator, uptr ClassId, CompactPtrT * ToArray, const u16 MaxBlockCount)

Defined at line 340 of file ../../third_party/scudo/src/primary32.h

void pushBlocks (SizeClassAllocatorT * SizeClassAllocator, uptr ClassId, CompactPtrT * Array, u32 Size)

Push the array of free blocks to the designated batch group.

Defined at line 361 of file ../../third_party/scudo/src/primary32.h

void disable ()

Defined at line 398 of file ../../third_party/scudo/src/primary32.h

void enable ()

Defined at line 411 of file ../../third_party/scudo/src/primary32.h

template <typename F>
void iterateOverBlocks (F Callback)

Defined at line 423 of file ../../third_party/scudo/src/primary32.h

void getStats (ScopedString * Str)

Defined at line 454 of file ../../third_party/scudo/src/primary32.h

void getFragmentationInfo (ScopedString * Str)

Defined at line 477 of file ../../third_party/scudo/src/primary32.h

bool setOption (Option O, sptr Value)

Defined at line 490 of file ../../third_party/scudo/src/primary32.h

uptr tryReleaseToOS (uptr ClassId, ReleaseToOS ReleaseType)

Defined at line 503 of file ../../third_party/scudo/src/primary32.h

uptr releaseToOS (ReleaseToOS ReleaseType)

Defined at line 513 of file ../../third_party/scudo/src/primary32.h