3 ms·
You are confounding two subjects: a bump allocator and an arena. "just increase the pointer" is a bump allocator. An arena can be used with any allocator, not
by vitiral 4y ago
You are confounding two subjects: a bump allocator and an arena.
"just increase the pointer" is a bump allocator.
An arena can be used with any allocator, not just bump allocators.
- foota 4y agoI think there's two common usages of the term arena, I might call them homogenous and non homogenous. Is there much reason to use a non homogenous arena with something other than a bump allocator?
- vitiral 4y agoI'm not sure what homogeneous means in this context? Arenas allow you to not worry about freeing memory, since it will all be freed in a single chunk. It also allows using allocators which are less concerned with fragmentation, since it is known that the arena memory will eventually be dropped. The amount you are concerned with fragmentation ranges from zero concern (bump allocator) to moderate concern (maybe buddy allocator) to larger concern depends on the application and its tradeoffs, like most things in software engineering.
- hyperman1 4y agoI think apache httpd works like this, and there the 2 subjects are mixed. They have a per-request arena. As it gets destroyed at the end of the request, you can just use a bump allocater which is one of the fastest ways to alloc memory.