Core Utils Block Allocator

Documentation for core/include/utils/blockAllocator

Page Contents

Motivation

We create stl-compatible custom block allocators for various types which allows for fast allocation and free-ing.

Note

xY.h is such that the x describes that we are using the custom allocator class, and the Y describes the underlying type e.g: list or map, etc.

References

For more context, read:

  1. An Efficient C++ Fixed Block Memory Allocator

TL;DR global heap allocation can be slow and nondeterministic. Also, this eliminates the possibility of memory allocation fault caused by a fragmented heap.

  1. Replace malloc/free with a Fast Fixed Block Memory Allocator

TL;DR replaces malloc and free with xmalloc and xfree which take advantage of the Allocator from above

  1. A Custom STL std::allocator Replacement Improves Performance

TL;DR describes how to create a STL-compatible version of the above code.