By: Foo_ (foo.delete@this.nomail.com), July 1, 2022 3:21 am
Room: Moderated Discussions
Adrian (a.delete@this.acm.org) on June 30, 2022 9:43 am wrote:
>
> When all the allocation and free requests are done from stacks, each stack corresponding
> to a certain size class, nothing ever changes from the point of view of fragmentation.
This is delusional. Allocation may be done "from stacks", but given that deallocations happen in random order (random from the POV of the allocator, of course), they cannot be done in a simple stack-like (i.e. LIFO) fashion.
Some allocators may be able to eliminate memory fragmentation in *some specific cases*, but certainly not in all cases (unless they are allowed to move objects in memory, of course).
And, yeah, if you always deallocate memory in reverse order of allocation, then the problem becomes trivial. It's also unrealistic.
>
> When all the allocation and free requests are done from stacks, each stack corresponding
> to a certain size class, nothing ever changes from the point of view of fragmentation.
This is delusional. Allocation may be done "from stacks", but given that deallocations happen in random order (random from the POV of the allocator, of course), they cannot be done in a simple stack-like (i.e. LIFO) fashion.
Some allocators may be able to eliminate memory fragmentation in *some specific cases*, but certainly not in all cases (unless they are allowed to move objects in memory, of course).
And, yeah, if you always deallocate memory in reverse order of allocation, then the problem becomes trivial. It's also unrealistic.