MEMResizeForMBlockFrmHeap

Syntax

#include <cafe/mem.h>

u32 MEMResizeForMBlockFrmHeap(
    MEMHeapHandle    heap,
    void*            memBlock,
    u32              newSize );

Parameters

heap Frame heap handle.
memBlock Pointer to the memory block to be resized.
newSize Size in bytes of the memory block change. If a value less than four is specified, four is used to process the memory block.

Return Values

If the function succeeds, returns the size in bytes of the changed memory block. Otherwise, zero is returned.

Description

This function changes the size of an allocated memory block in the frame heap. However, this function can only be applied to memory blocks that meet the following condition.

To allocate a memory block from the beginning of an available heap region, specify a positive alignment value when using either the MEMAllocFromFrmHeap or MEMAllocFromFrmHeapEx function.

When increasing the current size of the memory block, there must be enough free space after the memory block to increase the size. If there is insufficient available space, the function fails and returns zero. If the size increase of the memory block is successful, the size increase may be greater than the specified size.

Decreasing the memory block size is impossible if the size decrease is a few bytes. In this case, the current size of the memory block is returned.

This function does not check whether the value specified in memBlock indicates a pointer to a memory block that satisfies the conditions of this function. If a specified value does not satisfy the conditions, the behavior is unknown.

Do Not Call From

Callbacks Do not call this function from any callback function.

See Also

MEMAllocFromFrmHeap
MEMAllocFromFrmHeapEx
MEMCreateFrmHeap
MEMCreateFrmHeapEx

Revision History

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


CONFIDENTIAL