#include <stdint.h>
#include <types.h>
Go to the source code of this file.
|
| int32_t | smalloc_init (uint32_t p_heap_head, uint32_t n_heap_size) |
| | Initialize the simple malloc library with the specified heap parameters.
|
| |
| void * | smalloc (uint32_t num_bytes) |
| | Allocate a block of memory from the heap with the specified size.
|
| |
| void * | srealloc (void *p, uint32_t num_bytes) |
| | Reallocate a block of memory with the specified new size.
|
| |
| void | sfree (void *p) |
| | Free the memory block pointed to by the specified pointer.
|
| |
◆ BYTE_ALIGN
| #define BYTE_ALIGN |
( |
|
x | ) |
(((x + 15) / 16) * 16) |
◆ sfree()
Free the memory block pointed to by the specified pointer.
- Parameters
-
| p | The pointer to the memory block to free. |
◆ smalloc()
Allocate a block of memory from the heap with the specified size.
- Parameters
-
| num_bytes | The number of bytes to allocate. |
- Returns
- A pointer to the allocated memory block, or NULL if allocation fails.
◆ smalloc_init()
Initialize the simple malloc library with the specified heap parameters.
- Parameters
-
| p_heap_head | The starting address of the heap. |
| n_heap_size | The size of the heap in bytes. |
- Returns
- Zero if successful, non-zero otherwise.
◆ srealloc()
| void * srealloc |
( |
void * |
p, |
|
|
uint32_t |
num_bytes |
|
) |
| |
Reallocate a block of memory with the specified new size.
- Parameters
-
| p | The pointer to the memory block to reallocate. |
| num_bytes | The new size in bytes. |
- Returns
- A pointer to the reallocated memory block, or NULL if reallocation fails.