Working on new memory allocator.
While bump-allocators may yield extremely fast performance they are unsuitable for
being globally accessible and bound returned memory with lifetime of shared borrow.
It's hard to bump-allocated memory to escape function scope and unsafe to use in API
It's hard to bump-allocated memory to escape function scope and unsafe to use in API
that doesn't accept values with bound lifetime.
New memory allocator is ring-based and is called ring-alloc.
Instead of provide single reset function to reuse all pre-allocated memory invalidating previous allocations it works with common deallocation method.
It stores memory chunk in ring structure and traverses it exhausting each chunk before moving to next.
After full turn it tries to reuse chunk if all allocations made from it were deallocated. If not - new chunk is allocated and ring is extended.
This happens until longest allocation from ring is held no more than full ring. At which point it ceases allocating new chunks and just keep reusing those in ring.
New memory allocator is ring-based and is called ring-alloc.
Instead of provide single reset function to reuse all pre-allocated memory invalidating previous allocations it works with common deallocation method.
It stores memory chunk in ring structure and traverses it exhausting each chunk before moving to next.
After full turn it tries to reuse chunk if all allocations made from it were deallocated. If not - new chunk is allocated and ring is extended.
This happens until longest allocation from ring is held no more than full ring. At which point it ceases allocating new chunks and just keep reusing those in ring.
Have you ever needed to allocate memory for with short lifetime, but without known scope it would fit?
Yes
No
Allocation?
No votes yet, be the first!