Jo Engine Malloc.
More...
Go to the source code of this file.
Jo Engine Malloc.
- Author
- Johannes Fetz
- Bug:
- No known bugs.
◆ JO_MALLOC_MAX_MEMORY_ZONE
#define JO_MALLOC_MAX_MEMORY_ZONE |
Define the total of memory zone available through jo_add_memory_zone()
- Warning
- Minimum is 9 for the engine with all modules
◆ jo_extended_ram_cartridge_type
Extended RAM cartridge type.
Enumerator |
---|
CART_NONE | No cartridge.
|
CART_8MBits | 1 Mb cartridge
|
CART_32MBits | 4 Mb cartridge
|
◆ jo_malloc_behaviour
Malloc behaviour JO_MALLOC_TRY_REUSE_SAME_BLOCK_SIZE | ^ | | Speed efficiency | | V | JO_MALLOC_TRY_REUSE_BLOCK | ^ | | Speed efficiency | | V | JO_FAST_ALLOCATION.
Enumerator |
---|
JO_FAST_ALLOCATION | Default behaviour.
|
JO_MALLOC_TRY_REUSE_BLOCK | A little bit slower but reduce memory fragmentation.
|
JO_MALLOC_TRY_REUSE_SAME_BLOCK_SIZE | A little bit slower than JO_MALLOC_TRY_REUSE_BLOCK but reduce memory usage.
|
◆ jo_add_memory_zone()
void jo_add_memory_zone |
( |
unsigned char * |
ptr, |
|
|
const unsigned int |
size_in_bytes |
|
) |
| |
Register a memory segment for jo_malloc() usage.
- Parameters
-
ptr | Pointer to the beginning of the memory segment |
size_in_bytes | Size of the memory segment in bytes |
◆ jo_free()
void jo_free |
( |
const void *const |
p | ) |
|
function frees the memory space pointed to by p
- Parameters
-
p | pointer that must have been returned by a previous call to jo_malloc() |
◆ jo_malloc()
dynamic memory allocator
- Parameters
-
- Returns
- a pointer to the allocated memory or NULL if failed
◆ jo_malloc_with_behaviour()
dynamic memory allocator with specific behaviour
- Parameters
-
n | Segment size |
behaviour | Allocation Behaviour |
- Returns
- a pointer to the allocated memory or NULL if failed
◆ jo_memory_fragmentation()
int jo_memory_fragmentation |
( |
void |
| ) |
|
Get memory fragmentation (Number of fragment in memory)
- Returns
- Memory fragmentation
◆ jo_memory_usage_percent()
int jo_memory_usage_percent |
( |
void |
| ) |
|
Get memory usage percent.
- Returns
- memory usage percent
◆ jo_reduce_memory_fragmentation()
void jo_reduce_memory_fragmentation |
( |
void |
| ) |
|
Reduce memory fragmentation for faster memory allocation.