As some comments point out that this code might not be production ready, can anyone recommend other solutions that are able to manage a given block of memory? My understanding of libraries like jemalloc is that they are replacing malloc (using system calls brk and mmap [0]) but I can't hand it an already allocated block of memory to manage, right?
Something like
memory_manager m(some_buffer);
allocation a = m.allocate(512);
would be nice. :-)[0] https://medium.com/iskakaushik/eli5-jemalloc-e9bd412abd70