Memory Allocator
Tired of malloc and new?
Tired of malloc and new?
To get more control of the memory management one can create custom allocators. There are many ways of setting up a custom allocator depending on the needs of the program.
Allocator Types
Region: Allocate memory with an id, release id release all allocated mem.
Static Allocator that gets memory from a specifc address.
Memory pool
Slab: Splits assigned memory into slabs and each slab into slots. Return slots that fit requested memory.
Common allocator functions
Trace allocations. Like mem usage, number, size.
Common allocator options:
Align: Make sure that allocated memory is aligned to a specific byte size.
Canary Add buffer at and before allocations to check for buffer overuns.
Zero: Sets allocated memory to 0.