#include <cafe/mem.h>

u32 MEMCalcHeapSizeForUnitHeap(
                    u32     memBlockSize,
                    u32     memBlockNum,
                    int     alignment );


memBlockSize Size of the memory block in bytes.
memBlockNum Total number of reserved memory blocks.
alignment Memory block alignment. Can take any of the following values: 4, 8, 16, 32.

Return Values

The unit heap size calculated from the memory block size and the number of blocks is returned.


Gets the size of the required unit heap from the size and number of the memory blocks. When creating a unit heap, the number of memory blocks specified in memBlockNum can be allocated from the unit heap by specifying the value obtained using this function as the size of the memory region to allocate to the heap.

This function does not take into consideration the start address of the unit heap that is actually created. As a result, if a value greater than 4 is specified for the alignment, the size may be a few bytes larger than needed.

Do Not Call From

Callbacks Do not call this function from any callback function.

See Also


Revision History

2013/05/08 Automated cleanup pass.
2010/11/01 Initial version.