nn::fnd::ExpHeapTemplate::Allocate Member Function

Syntax

void * Allocate(
     size_t byteSize,
     s32 alignment = DEFAULT_ALIGNMENT,
     bit8 groupId = 0,
     AllocationMode mode = ALLOCATION_MODE_FIRST_FIT,
     bool reuse = false
);

Arguments

Name Description
in byteSize Specifies the size (in bytes) of the memory block to allocate.
in alignment Specifies the alignment. You can specify a power of two between -128 and 128 with an absolute value of 4 or greater.
in groupId Specifies the group ID.
in mode Specifies the mode to use for memory block allocation.
in reuse Specifies whether to reuse the gaps in memory that occur during alignment.

Return Values

Returns the starting address of the allocated memory block.

Description

Allocates memory from the expanded heap.

The following values can be specified in alignment: -128, -64, -32, -16, -8, -4, 4, 8, 16, 32, 64, and 128.

This function starts searching at the beginning of the heap if alignment is positive or at the end of the heap if alignment is negative and then allocates the free region that it finds.

Revision History

2010/10/27
Because a problem with memory leak was discovered when values greater than 128 was specified with alignment, the value range was restored to -128 to 128.
2010/09/17
Changed the values that can be specified for alignment to the range between -4096 and 4096. Added information on the meanings of positive and negative alignment values.
2010/05/21
Changed valid values for alignment to -128 through 128.
2010/01/07
Initial version.

CONFIDENTIAL