0

I'm interested in a library for managing allocation and de-allocation of memory within an abstract slab. That is, a library which doesn't use malloc()/operator new/sbrk, but initially gets a contiguous range of addresses (maybe I've malloc()ed for it, or maybe it's managing space on some remote device), but takes allocation and de-allocation requests and returns regions within the slab. The memory managing code does also not access the memory it manages; it doesn't know what that memory is, so it can't do things like write to it, or move parts of it elsewhere etc.

Requirements:

  • Gratis
  • Free and Open Source
  • Has some documentation
  • Note that the allocation mechanism cannot use the slab/arena to store any state (counters, pointers etc.); it can use the default allocator (e.g. malloc()/new) or some other mechanism for that.

Preferences:

  • C or C++ bindings
  • Written in modern C++
  • Supports prospective/time-based allocation ("I need X bytes between abstract time point t_1 and abstract time point t_2"; this allows for over-allocation over all time units, as long as there is no over-allocation at an individual time unit.)
  • Supports specifying alignment requirements
  • Supports resizing better than allocating a new segment and deallocating the old one
  • Actively maintained
0
+50

Take look at the boost pool library which is a C++ library which has most of the features you are looking for. It is part of the boost library which is open source, well maintained and tested portable library.

In the detailed documentation about pool it dives into how memory segmentation and allocation is handled. It is very well documented with extensive test cases.

  • Looking at the documentation for that, it seems boost pool does use the slab/arena to store state - so this does not fit my criteria. I've edited to make that clearer. – einpoklum - reinstate Monica Mar 19 '17 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.