🌊 Sailfish pool (sfpool)
Secure and Fast memory pool, in 300 lines of portable, header-only C code.
|
Functions | |
void | sfutil_zero (void *ptr, uint32_t size) |
Zeroes out a block of memory. | |
void * | sfutil_memalign (const void *ptr) |
Aligns a pointer to the nearest boundary. | |
void * | sfutil_secalloc (size_t size) |
Allocates memory securely. | |
void | sfutil_secfree (void *ptr, size_t size) |
Frees memory allocated securely. | |
void * sfutil_memalign | ( | const void * | ptr | ) |
Aligns a pointer to the nearest boundary.
This function aligns the given pointer to the nearest boundary specified by ptr_align
.
ptr | Pointer to align. |
void * sfutil_secalloc | ( | size_t | size | ) |
Allocates memory securely.
This function allocates memory securely, ensuring it is aligned and locked (if supported by the platform).
size | Size of the memory block to allocate. |
void sfutil_secfree | ( | void * | ptr, |
size_t | size | ||
) |
Frees memory allocated securely.
This function frees memory that was allocated using sfutil_secalloc
.
ptr | Pointer to the memory block to free. |
size | Size of the memory block in bytes. |
void sfutil_zero | ( | void * | ptr, |
uint32_t | size | ||
) |
Zeroes out a block of memory.
This function sets a block of memory to zero using 32-bit writes for efficiency.
ptr | Pointer to the memory block to zero out. |
size | Size of the memory block in bytes. |