General Tech
The Double Headed Stack Allocator
The Double Headed Stack Allocator is a memory allocation method that improves performance by reducing the number of cache misses. It was originally developed by Intel for their Itanium processors. The allocator uses two stacks, one for small allocations and one for large allocations, and switches between them based on the size of the requested allocation. This approach reduces the number of cache misses by keeping frequently accessed objects in one stack and less frequently accessed objects in the other. The allocator also uses a 'chunk' mechanism to manage memory, where a chunk is a contiguous block of memory that can be used to satisfy multiple allocations. Chunks are split and merged as needed to minimize fragmentation. The allocator is designed to be highly concurrent and scalable, making it suitable for multi-threaded applications. The author of the allocator, who remains anonymous, has made the code available under the permissive MIT license.
Read the full article at blog.demofox.org →