![]() |
Maria GDK 5.0.0.1005
Documentation of native code in develop branch
|
#include <StkBuddyAllocator.h>
Public Member Functions | |
| BuddyAllocator (size_t minBlockBytes, size_t initialCapacityBytes) | |
| void | reset (size_t initialCapacityBytes) |
| Reset allocator to empty with at least 'initialCapacityBytes'. | |
| size_t | allocate (size_t sizeBytes) |
| void | free (size_t offsetBytes, size_t sizeBytes) |
| Free an allocation at byte offset with exact size in bytes. | |
| size_t | capacity () const |
| size_t | minBlock () const |
Static Public Attributes | |
| static constexpr size_t | npos = static_cast<size_t>(-1) |
Power-of-two buddy allocator in bytes. https://en.wikipedia.org/wiki/Buddy_memory_allocation This class handles memory allocation/freeing using the Buddy Allocation algorithm.
|
inline |
Allocate bytes. This method will allocate sizeBytes and return a byte offset (aligned to block size) to the start of the allocated memory. Will return npos on error. This method grows automatically (by doubling) until it succeeds.