KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
Allocator

Memory management API for VRAM. More...

Functions

pvr_ptr_t pvr_mem_malloc (size_t size)
 Allocate a chunk of memory from texture space.
 
void pvr_mem_free (pvr_ptr_t chunk)
 Free a block of allocated memory in the PVR RAM pool.
 
uint32_t pvr_mem_available (void)
 Return the number of bytes available still in the PVR RAM pool.
 
void pvr_mem_reset (void)
 Reset the PVR RAM pool.
 
void pvr_mem_print_list (void)
 Print the list of allocated blocks in the PVR RAM pool.
 
void pvr_mem_stats (void)
 Print statistics about the PVR RAM pool.
 

Detailed Description

Memory management API for VRAM.

PVR memory management in KOS uses a modified dlmalloc; see the source file pvr_mem_core.c for more info.

Function Documentation

◆ pvr_mem_available()

uint32_t pvr_mem_available ( void  )

Return the number of bytes available still in the PVR RAM pool.

Returns
The number of bytes available

◆ pvr_mem_free()

void pvr_mem_free ( pvr_ptr_t  chunk)

Free a block of allocated memory in the PVR RAM pool.

This function frees memory previously allocated with pvr_mem_malloc().

Parameters
chunkThe location of the start of the block to free

◆ pvr_mem_malloc()

pvr_ptr_t pvr_mem_malloc ( size_t  size)

Allocate a chunk of memory from texture space.

This function acts as the memory allocator for the PVR texture RAM pool. It acts exactly as one would expect a malloc() function to act, returning a normal pointer that can be directly written to if one desires to do so. All allocations will be aligned to a 32-byte boundary.

Parameters
sizeThe amount of memory to allocate
Returns
A pointer to the memory on success, NULL on error

◆ pvr_mem_print_list()

void pvr_mem_print_list ( void  )

Print the list of allocated blocks in the PVR RAM pool.

This function only works if you've enabled KM_DBG in pvr_mem.c.

◆ pvr_mem_reset()

void pvr_mem_reset ( void  )

Reset the PVR RAM pool.

This will essentially free any blocks allocated within the pool. There's generally not many good reasons for doing this.

◆ pvr_mem_stats()

void pvr_mem_stats ( void  )

Print statistics about the PVR RAM pool.

This prints out statistics like what malloc_stats() provides. Also, if KM_DBG is enabled in pvr_mem.c, it prints the list of allocated blocks.