Hermes  0.9.5-beta
Hierarchical Distributed I/O Buffering System
hermes::Arena Struct Reference

#include <memory_management.h>

Public Attributes

u8base
 
size_t used
 
size_t capacity
 
ArenaErrorFuncerror_handler
 
i32 temp_count
 

Detailed Description

A block of memory that can be divided up dynamically.

An Arena must be initialized from a contiguous block of allocated memory. After it's initialized, you can use it like new via the PushStruct and PushArray calls. Note that this Arena is designed to persist for the application lifetime, so we don't have a need to free anything out of it.

Example:

size_t arena_size = 4 * 1024;
void *block_base = malloc(arena_size);
Arena arena = {};
InitArena(&arena, arena_size, block_base);
MyStruct *s = PushStruct<MyStruct>(&arena);
void InitArena(Arena *arena, size_t bytes, u8 *base)
Definition: memory_management.cc:71

Member Data Documentation

◆ base

u8* hermes::Arena::base

The beginning of the memory block tracked by this Arena

◆ used

size_t hermes::Arena::used

Number of bytes currently in use

◆ capacity

size_t hermes::Arena::capacity

Total number of bytes in the block tracked by this Arena

◆ error_handler

ArenaErrorFunc* hermes::Arena::error_handler

Per-arena error handling function

◆ temp_count

i32 hermes::Arena::temp_count

The number of ScopedTemporaryMemory instances that are using this Arena


The documentation for this struct was generated from the following file: