CppCon 2020 has ended
Back To Schedule
Wednesday, September 16 • 09:00 - 10:00
Practical Memory Pool Based Allocators For Modern C++

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
Runtime-deterministic memory allocations are a crucial aspect of any safety-critical real-time system. One of the simplest and widely adopted allocation mechanisms used in such systems is a memory pool with fixed block sizes. Unfortunately, the need to know the exact sizes of the memory blocks makes any practical usage of memory pools with standard C++ allocator-based approach rather problematic since users often “hide” real properties of allocations which are made under the hood. For example: STL’s node-based containers like 'std::map' as well as other standard mechanisms like 'std::promise' or 'std::allocate_shared'.

Being a company which focuses on real-time safety-critical applications, we still see a significant value in keeping compatibility with the standard allocator model as well as in following common conventions which are familiar to every C++ developer.

This talk presents an approach which uses a combination of a memory allocator implementation which instruments the code, and an external LLVM-based tool which extracts the instrumentation information and generates static memory pool definitions, allowing the allocator to switch from the heap to a memory pool without any further changes to the code. The presentation will walk through a simplest possible implementation of this approach.

avatar for Misha Shalem

Misha Shalem

C++ Architect, Apex.AI
C++ developer with 16+ years of experience. Currently holds position of C++ Architect at Apex.AI, Palo Alto, CA

Wednesday September 16, 2020 09:00 - 10:00 MDT