MEMResizeForMBlockFrmHeap

C Specification

#include <revolution/mem.h>

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

Arguments

heap The frame heap handle.
memBlock Pointer to the memory block to change in size.
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.

Use either the MEMAllocFromFrmHeap or the MEMAllocFromFrmHeapEx function and specify a positive alignment value to allocate a memory block from the bottom of the free heap region.

When increasing the current size of the memory block, there must be enough free space after the memory block to increase the size. If the free region is insufficient, 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 that memBlock specifies points to the memory block that satisfies the conditions of this function. If a specified values doesn't satisfy the conditions, the behavior is unknown.

See Also

MEMAllocFromFrmHeap, MEMAllocFromFrmHeapEx, MEMCreateFrmHeap, MEMCreateFrmHeapEx

Revision History

03/01/2006 Initial version.