#include "common/libc/alloc.h"
#include <stddef.h>
#include <stdint.h>
#include "common/hardware/pcsxhw.h"
Go to the source code of this file.
◆ ALIGN_MASK
| #define ALIGN_MASK ((2 * sizeof(void *)) - 1) |
◆ ALIGN_TO
◆ bottom
| #define bottom s_heap_metadata.bottom |
◆ check_integrity
| #define check_integrity |
( |
| ) |
|
◆ dprintf
◆ head
| #define head s_heap_metadata.head |
◆ marker
| #define marker s_heap_metadata.marker |
◆ maximum_heap_end
| #define maximum_heap_end s_heap_metadata.maximum_heap_end |
◆ print_block
◆ top
| #define top s_heap_metadata.top |
◆ allocated_block
◆ empty_block
◆ __builtin_delete()
◆ __builtin_new()
| void * __builtin_new |
( |
size_t |
size | ) |
|
◆ _ZdaPv()
◆ _ZdaPvj()
◆ _ZdlPv()
◆ _ZdlPvj()
◆ _Znaj()
◆ _Znwj()
◆ libc_free()
Frees memory from the heap.
This function behaves as you'd expect from typical free. Calling this function with a NULL pointer is a no-op.
- Parameters
-
| ptr | The pointer to the memory to free. |
◆ libc_heap_end()
Returns the pointer to the end of the heap.
This function will return the pointer to the end of the heap. The heap works lazily, and this function may return a NULL pointer. Once it returns a non-NULL pointer, it will approximately correspond to the current end of the heap. The heap may actually be larger than this pointer on occasion. The heap will always grow, and never shrink.
- Returns
- void* The end of the heap.
◆ libc_heap_start()
| void * libc_heap_start |
( |
| ) |
|
Returns the pointer to the beginning of the heap.
This function will return the pointer to the beginning of the heap. The heap works lazily, and this function may return a NULL pointer, but once it returns a non-NULL pointer, it will always return the same pointer.
- Returns
- void* The beginning of the heap.
◆ libc_malloc()
| void * libc_malloc |
( |
size_t |
size | ) |
|
Allocates memory from the heap.
This function behaves as you'd expect from typical malloc. Allocating 0 bytes will return a valid pointer, which can be freed. Guarantees to align the memory to 8 bytes.
- Parameters
-
| size | The amount of bytes to allocate. |
- Returns
- void* The memory allocated.
◆ libc_realloc()
| void * libc_realloc |
( |
void * |
ptr, |
|
|
size_t |
size |
|
) |
| |
Re-allocates memory from the heap.
This function behaves as you'd expect from typical realloc. Allocating 0 bytes with a NULL pointer will return a valid pointer, which can be freed. Allocating 0 bytes with a valid pointer will behave as if free was called. Re-allocating a pointer to a smaller size is always guaranteed to succeed and to return the same pointer. Re-allocating a pointer to a larger size may fail, in which case, it will return NULL. Passing a NULL pointer will behave like a call to malloc.
- Parameters
-
| ptr | The pointer to the memory to re-allocate. |
| size | The amount of bytes to allocate. |
- Returns
- void* The memory allocated.
◆ __heap_start
◆ __stack_start
◆ bottom
◆ head
◆ marker
◆ maximum_heap_end
◆ top