4 ms·
> I'm not sure what this means. It means the structure storage is contained within the vector storage and you return an index, just as if it were an arena. Th
by naasking 3y ago
> I'm not sure what this means.
It means the structure storage is contained within the vector storage and you return an index, just as if it were an arena.
The problem is that such an approach can only allocate a homogenous set of types and sizes.
> Also a lot of arena implementations are basically linked lists inside a vector and freeing up the memory means jumping around in memory
That's not an arena. The whole point of an arena is deallocation of all elements allocated from that arena is a constant time bulk operation.
- CyberDildonics 3y agoThat's not an arena. The whole point of an arena is deallocation of all elements allocated from that arena is a constant time bulk operation. I've seen both, you can use empty cells to link to the next empty cell and the head pointer to link to the first empty cell in the chain so that the cells can be arbitrarily freed, but the option is always there to do what you said and do a single bulk deallocation of the actual heap memory allocation instead of dealing with individual cells. My point in all this is the same thing you have been implying. There aren't many differences in techniques so when people are talking about 'arena allocators' most of the time they should just be using a vector.