Crate o1heap

Crate o1heap 

Source

Structs§

InitError
Error returned when heap initialization fails.
O1Heap
O1HeapDiagnostics
Runtime diagnostic information. This information can be used to facilitate runtime self-testing, as required by certain safety-critical development guidelines. If assertion checks are not disabled, the library will perform automatic runtime self-diagnostics that trigger an assertion failure if a heap corruption is detected. Health checks and validation can be done with o1heapDoInvariantsHold().
O1HeapInstance

Constants§

ALIGNMENT
The guaranteed alignment of allocated memory (platform-dependent). On 32-bit systems: 16 bytes. On 64-bit systems: 32 bytes.

Statics§

o1heapMinArenaSize
o1heapInit() will fail unless the arena size is at least this large. This value depends only on the machine architecture. The other reason to fail is if the arena pointer is not aligned at O1HEAP_ALIGNMENT.

Functions§

min_arena_size
Returns the minimum arena size required for initialization.
o1heapAllocate
The semantics follows malloc() with additional guarantees the full list of which is provided below.
o1heapDoInvariantsHold
Performs a basic sanity check on the heap. This function can be used as a weak but fast method of heap corruption detection. If the handle pointer is NULL, the behavior is undefined. The time complexity is constant. The return value is truth if the heap looks valid, falsity otherwise.
o1heapFree
The semantics follows free() with additional guarantees the full list of which is provided below.
o1heapGetDiagnostics
Samples and returns a copy of the diagnostic information, see O1HeapDiagnostics. This function merely copies the structure from an internal storage, so it is fast to return. If the handle pointer is NULL, the behavior is undefined.
o1heapGetMaxAllocationSize
Obtains the maximum theoretically possible allocation size for this heap instance. This is useful when implementing std::allocator_traits::max_size.
o1heapInit
The arena base pointer shall be aligned at O1HEAP_ALIGNMENT, otherwise NULL is returned.
o1heapTraceAllocate
Advanced diagnostic hooks; not used by default. If O1HEAP_TRACE is not defined or is zero, these functions should be left unimplemented. Iff O1HEAP_TRACE is defined and is nonzero, the library will emit trace events by invoking these functions, which are to be defined in the application (or linking will fail).
o1heapTraceFree