ArenaConfig Reference

Configuration for an arena allocator

Context

_images/ditaa-a4a4ae6766a81f4803a64c4fb73efbeea1224937.png

object cfg<<AreanConfig>>
cfg : name = "tmp"
cfg : size = 128MB
cfg : hugepage_z = 2MB
cfg : guard_z = 8
cfg : guard_byte = 0xfd
cfg : store_header_flag = true
cfg : header_size_mask = 0xffffffff
cfg : debug_flag = false

example arena config

#include <xo/arena/ArenaConfig.hpp>

Class

class ArenaConfig

configuration for a DArena instance

Instance Variables

group ArenaConfig members

Variables

MemoryNameStr name_

optional name, for diagnostics

std::size_t size_ = 0

desired arena size &#8212; hard max = reserved virtual memory

std::size_t base_align_z_ = 0

desired alignment for this arena’s BASE address. 0 for the page/hugepage default.

Allow recovering an arena’s base from any pointer in that arena, by masking off the low-order base_align_z_-1 bits. This is sound only if

size_ <= base_align_z_ 
See with_base_align_z.

bool exclusive_block_flag_ = false

when base_align_z_ > 0: true to reserve the whole base_align_z_ block rather than just size_. Applies to address space, not committed memory. Ignored when base_align_z_ is zero.

See with_exclusive_block_flag.

std::size_t hugepage_z_ = 2 * 1024 * 1024

hugepage size &#8212; using huge pages relieves some TLB pressure (provided you use their full extent :)

bool store_header_flag_ = false

true to store header (8 bytes) at the beginning of each allocation. necessary and sufficient to allows iterating over allocs present in arena.

AllocHeaderConfig header_ = {}

configuration for per-alloc header

bool debug_flag_ = false

true to enable debug logging