# NNS_FndCalcHeapSizeForUnitHeap

## Syntax

      #include <nnsys/fnd.h>

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

## Arguments

memBlockSize | Memory block size (in bytes)
memBlockNum | Total Number of memory blocks to be allocated
alignment | Memory block alignment. Can take any of the following values: 4, 8, 16, 32.

## Return Values

This returns the unit heap size calculated from the memory block size and the number of blocks.

## Description

Obtains the size of the required unit heap by taking the size and quantity 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 area allocated to the heap.

This function does not take into consideration the starting address of the unit heap that is actually created. For this reason, if a value greater than 4 is specified for the alignment, the size may be a few bytes larger than actually necessary.

## See Also

`NNS_FndCreateUnitHeap, NNS_FndCreateUnitHeapEx`

## Revision History

2004/06/22 Initial version.

CONFIDENTIAL