# NNS_FndResizeForMBlockFrmHeap

## Syntax

      #include <nnsys/fnd.h>

      u32 NNS_FndResizeForMBlockFrmHeap(
              NNSFndHeapHandle    heap,
              void*               memBlock,
              u32                 size);

## Arguments

heap | Frame heap handle.
memBlock | Pointer to the memory block which changes size.
size | Size (in bytes) of memory block to be changed. If a value less than 4 is specified, it will be processed as though a 4 had been specified.

## Return Values

Returns the size (in bytes) of the changed memory block if the function succeeds. 0 is returned if the function doesn't succeed.

## Description

This changes the size of a memory block allocated from the frame heap. Note that there are conditions regarding the memory blocks whose size can be changed. The following condition must be true.

- The last memory block allocated among the memory blocks allocated from the front of the empty area in the heap.

Use either the `NNS_FndAllocFromFrmHeap()` function or the `NNS_FndAllocFromFrmHeapEx()` function and specify a positive value for the alignment value to allocate a memory block from the front of the empty area in the heap.

When making the memory block larger than the current size, there must be sufficient empty space for expansion at the end of the memory block. If there is insufficient empty space, the function will fail and 0 will be returned. If the size of the memory block is successfully increased, the size may be larger than desired.

Decreasing the current size of the memory block, may not be possible if the decrease in size amounts to just a few bytes. In such cases, the size of the current memory block will be returned.

With this function, there is no check to see if the the value specified using `memBlock` points to the pointer for the memory block that satisfies the conditions of this function. The behavior is uncertain when a value that does not satisfy the conditions has been specified.

## See Also

`NNS_FndAllocFromFrmHeap, NNS_FndAllocFromFrmHeapEx, NNS_FndCreateFrmHeap, NNS_FndCreateFrmHeapEx`

## Revision History

2004/08/02 Initial version.

CONFIDENTIAL