Comment by hn_submit
4 days ago
Why not a seperate stack allocator for each type of object? Here you use two object types so you can use a double-headed stack allocator, but what if you have three type of objects?
4 days ago
Why not a seperate stack allocator for each type of object? Here you use two object types so you can use a double-headed stack allocator, but what if you have three type of objects?
The system in TFA can only handle 2 "categories". Note that there could be many distinct types in each category; the important thing about categories is that everything in the same category should share an allocation/deallocation timeline. If this holds separately for each category, there will be no fragmentation.
For this 2-category case, the double-headed stack is strictly better than maintaining 2 separate half-size stacks, since it permits every sequence of allocations and deallocations that the latter permits, while there are sequences that it permits that the latter does not permit (namely, any sequence in which more than half the memory is temporarily needed by one of the categories, and the other category is temporarily not using it).