cptr::bump_allocator

A thread-safe bump (monotonic) allocator for user_cage: allocation is a pointer increment, deallocate() does nothing, and memory is committed in 1 MiB steps as it is used. Suited to data that is built once and freed all at once, or never. Its lock is held across fork(), so a child process can allocate even if another thread was allocating when it forked.

Synopsis

Declared in <cptr/user_cage.hpp>

class bump_allocator;

Member Functions

NameDescription
bump_allocator [constructor]Construct from span
allocate
deallocate
used Bytes handed out so far, including alignment padding.