#include <cafe/os.h> void* LCAlloc( u32 nBytes );
|nBytes||The number of bytes to allocate from the locked cache. The minimum size is 512 bytes (
NULL on failure. Returns the pointer to locked cache memory on success.
Allocates locked cache memory from the current core. Each core has its own locked cache memory heap.
With dynamic allocation and deallocation, fragmentation can occur where the desired number of bytes is unallocated but not contiguous. The heap algorithm first tries to allocate the memory on addresses aligned based on size. For example, a 1024B allocation request tries to find a free 1024B block on a 1024-byte aligned address. If none is found, then a first-fit search starting at the low LC address is used.
An application can allocate a maximum of 16 KB for each core. If there is LC space left unused (2 to 4 KB), the system libraries and operating system can take advantage of it and potentially increase performance (such as for C libraries).
|Background, Cores 0 & 1||In applications, do not call this function from Core 0 or 1 when in the background.|
|Callbacks||Do not call this function from any callback function.|
2013/05/08 Automated cleanup pass.
LCGetAllocatableSize. Removed LCLoadDMAASync and LCStoreDMAASync.
2011/03/15 Initial version.