|
|
|
|
|
by arbor-group
51 days ago
|
|
Where I have landed with arenas is that the allocator is the easy part, and being honest about lifetimes is the hard part. They work beautifully when the work has a clear phase shape — parse a request, walk a tree, build a result, then throw it all away — because you stop paying for a thousand individual frees and you stop fragmenting the heap. They go wrong quietly when something that actually lives longer gets allocated in the arena and either keeps the whole block alive or gets used after a reset. The pattern that has saved me is separate scratch and long-lived arenas, plus a hard rule that nothing crosses that boundary without an explicit copy. I also want a high-water mark in debug builds, otherwise peak usage creeps up unnoticed until a large input makes it obvious all at once. |
|