MEMCalcHeapSizeForUnitHeap

Syntax

#include <revolution/mem.h>

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

Arguments

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.

Description

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.

See Also

MEMCreateUnitHeap, MEMCreateUnitHeapEx

Revision History

2006/03/01 Initial version.


CONFIDENTIAL