#include <GlobalBufferMemoryManager.h>
|
| static void | initialize () |
| | Initialize the memory manager.
|
| |
| static void * | allocate (size_t size) |
| | Allocate memory from the global buffer.
|
| |
| static void | deallocate (void *ptr) |
| | Deallocate previously allocated memory.
|
| |
| static void * | reallocate (void *ptr, size_t newSize) |
| | Resize allocated memory.
|
| |
| static size_t | getTotalFreeMemory () |
| | Get the total free memory available in the buffer.
|
| |
| static size_t | getLargestFreeBlock () |
| | Get the size of the largest available free block.
|
| |
◆ allocate()
| void * uniot::GlobalBufferMemoryManager::allocate |
( |
size_t | size | ) |
|
|
static |
Allocate memory from the global buffer.
- Parameters
-
| size | Number of bytes to allocate |
- Return values
-
| void* | Pointer to the allocated memory block |
| nullptr | If allocation fails |
◆ deallocate()
| void uniot::GlobalBufferMemoryManager::deallocate |
( |
void * | ptr | ) |
|
|
static |
Deallocate previously allocated memory.
Returns the memory block to the free list, merging with adjacent free blocks when possible.
- Parameters
-
| ptr | Pointer to memory previously allocated with allocate() |
◆ getLargestFreeBlock()
| size_t uniot::GlobalBufferMemoryManager::getLargestFreeBlock |
( |
| ) |
|
|
static |
Get the size of the largest available free block.
- Return values
-
| size_t | Size in bytes of the largest contiguous free block |
◆ getTotalFreeMemory()
| size_t uniot::GlobalBufferMemoryManager::getTotalFreeMemory |
( |
| ) |
|
|
static |
Get the total free memory available in the buffer.
- Return values
-
| size_t | Total bytes available across all free blocks |
◆ initialize()
| void uniot::GlobalBufferMemoryManager::initialize |
( |
| ) |
|
|
static |
Initialize the memory manager.
Sets up the free list with a single large block covering the entire buffer. Must be called before any other memory operations.
◆ reallocate()
| void * uniot::GlobalBufferMemoryManager::reallocate |
( |
void * | ptr, |
|
|
size_t | newSize ) |
|
static |
Resize allocated memory.
Either returns the existing block if it's large enough, or allocates a new block, copies the data, and frees the old block.
- Parameters
-
| ptr | Pointer to memory previously allocated with allocate(), or nullptr |
| newSize | New size in bytes |
- Return values
-
| void* | Pointer to the resized memory block |
| nullptr | If reallocation fails |
The documentation for this class was generated from the following files: