MEMResizeForMBlockFrmHeap

Syntax

#include <revolution/mem.h>

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

Arguments

heap Frame heap handle
memBlock Pointer to the memory block to be resized
size 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 doesn't 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 doesn't satisfy the conditions, the behavior is unknown.

See Also

MEMAllocFromFrmHeap, MEMAllocFromFrmHeapEx, MEMCreateFrmHeap, MEMCreateFrmHeapEx

Revision History

2006/03/01 Initial version.


CONFIDENTIAL