MEMAllocFromDefaultHeap

Syntax

#include <cafe/mem.h>

typedef void * (*pfMEMAllocFromDefaultHeap)(u32 size);
extern pfMEMAllocFromDefaultHeap MEMAllocFromDefaultHeap;

Parameters

size Requested size of the allocation.

Return Values

When the memory block is allocated, the start address of this memory block is returned. When memory cannot be allocated, NULL is returned.

Description

Allocates a memory block from the default heap. The memory block has an alignment of 4 bytes. To specify an alternate alignment, use the MEMAllocFromDefaultHeapEx function.

You may decide to override the allocation implementation, substituting your own in place of the default one provided in the OS libraries. Such a substitution should only be performed in a __preinit_user function that you provide, as described in Customize Memory Management.

Do Not Call From

Callbacks Do not call this function from any callback function.

See Also

MEMAllocFromDefaultHeapEx
MEMFreeToDefaultHeap
MEMCreateUserHeapHandle

Revision History

2014/02/28 Remove unused MEMInitDefaultHeap.
2013/06/20 Correctly describe how substitute an alternate implementation.
2013/05/08 Automated cleanup pass.
2010/11/01 Initial version.


CONFIDENTIAL