Add a STL Allocator using the stack (for rt safety)

Multimedia / Ardour - Robin Gareus [gareus.org] - 6 March 2020 18:13 UTC

This is a dumb stack allocator using LIFO allocation/free, with a fallback to new/delete. This works well for small STL containers in particular std::vector, but it's also suitable for std::map<>, in particular copy constructing small POD maps (plugin pin mappings).

Eventually this could be combined with TLSF for a flexible memory arena management. This is however not currently needed for any the planned use-cases.

This code is ANSI C++98 compatible, and yet also works with modern C++11, C++14

50556db405 Add a STL Allocator using the stack (for rt safety)
libs/pbd/pbd/stack_allocator.h | 159 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 159 insertions(+)

  • Share