#include <cafe/mem.h>

typedef void * (*pfMEMAllocFromDefaultHeapEx)(u32 size, int alignment);
extern pfMEMAllocFromDefaultHeapEx MEMAllocFromDefaultHeapEx;


size Requested size of the allocation.
alignment Requested alignment for the base address of the allocation. Alignment up to 64 kB is supported.

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.


Allocates a memory block from the default heap using the specified alignment. If you do not need a special alignment it is best to use the MEMAllocFromDefaultHeap function instead.

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


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.