memory-allocators icon indicating copy to clipboard operation
memory-allocators copied to clipboard

Optimize PoolAllocator initialization by adding an Offset variable?

Open ImYellowFish opened this issue 3 years ago • 0 comments

As discussed in readme.md, the pool allocator initialize freeNodeList with O(N) complexity. However before any free() is invoked, it behaves like a LinearAllocator.

So we could just leave the freeNodeList empty, and add an Offset variable to indicate current free node, and increase this Offset whenever allocation is performed. When free() is called, we add the freed space into freeNodeList, which will be looked upon first for later allocations.

ImYellowFish avatar Nov 30 '22 08:11 ImYellowFish