|
libmemalloc
v3.0.00
Modern Memory Allocator
|
#include <pthread.h>#include <stdatomic.h>#include <stdbool.h>#include <stdint.h>#include <string.h>#include "memalloc_utils.h"Go to the source code of this file.
Macros | |
| #define | GC_INTERVAL_MS (uint16_t)(100U) |
| Default interval in milliseconds between GC cycles. | |
Enumerations | |
| enum | allocation_strategy_t { FIRST_FIT = (uint8_t)(0u) , NEXT_FIT = (uint8_t)(1u) , BEST_FIT = (uint8_t)(2u) } |
| Defines allocation strategies for memory management. More... | |
Functions | |
| void * | MEM_memset (void *const source, const int value, const size_t size) |
| Fills a memory block with a specified byte value using optimized operations. | |
| void * | MEM_memcpy (void *const dest, const void *src, const size_t size) |
| Copies a memory block between buffers using optimized operations. | |
| void * | MEM_allocFirstFit (const size_t size) |
| Allocates memory using the FIRST_FIT strategy. | |
| void * | MEM_allocBestFit (const size_t size) |
| Allocates memory using the BEST_FIT strategy. | |
| void * | MEM_allocNextFit (const size_t size) |
| Allocates memory using the NEXT_FIT strategy. | |
| void * | MEM_alloc (const size_t size, const allocation_strategy_t strategy) |
| Allocates memory using the specified strategy. | |
| void * | MEM_calloc (const size_t size, const allocation_strategy_t strategy) |
| Allocates and zero‐initializes memory using the specified strategy. | |
| void * | MEM_realloc (void *const ptr, const size_t new_size, const allocation_strategy_t strategy) |
| Reallocates memory with safety checks using the specified strategy. | |
| int | MEM_free (void *const ptr) |
| Releases allocated memory back to the heap. | |
Implements memory allocator with advanced features: