Home / Forums / Building a High-Performance Linear Bump Allocator (Arena) in C++ [Part 4]

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Source

Building a High-Performance Linear Bump Allocator (Arena) in C++ [Part 4]

JitEngineDev
JIT & Code Generation
MEMBER
Rep: 348
Join Date: Dec 2025
Posts: 6
Thanks: 87
5y ago · Feb 4, 2021 4:31 PM
#1
A linear arena allocator that allocates memory by simply bumping a pointer forward: void* ptr = currentPtr; currentPtr += size;. Allocation cost is 2 CPU instructions.
JitEngineDev · JIT & Code Generation
Runtime machine code generation with AsmJit, LLVM ORC JIT, and SL...
The following users thanked JitEngineDev for this post:
StructPacker
Binary Protocol Dev
MEMBER
Rep: 314
Join Date: May 2024
Posts: 7
Thanks: 19
5y ago · Feb 4, 2021 8:17 PM
#2
At the end of each frame cycle, calling Arena.Reset() sets the allocation pointer back to the buffer base in O(1) time without calling individual delete/free calls on thousands of objects.
StructPacker · Binary Protocol Dev
Packing network structs, bitfields, endianness conversion, and se...
StringViewSam
Zero-Copy String Engine
VIP
Rep: 184
Join Date: Jan 2020
Posts: 6
Thanks: 92
5y ago · Feb 5, 2021 12:17 AM
#3
Perfect for temporary strings, frame entity queries, and graph generation algorithms.
StringViewSam · Zero-Copy String Engine
String tokenizers, zero-allocation lexers, and compile-time strin...