MEMInitBlockHeap

Syntax

#include <cafe/mem.h>

MEMHeapHandle  MEMInitBlockHeap(
            MEMBlockHeap *  tracking,
            void *          start_addr,
            void *          end_addr,
            void *          init_track_mem,
            u32             init_track_mem_bytes,
            u16             optFlag
            );

Parameters

tracking Address of block heap tracking base. This is usually statically allocated or allocated from another heap. If allocated from another heap, a 4-byte alignment should be used.
start_addr Starting address of range of memory to track with this block heap. No tracking information or heap structures are placed into the memory range.
end_addr Ending address of range of memory to track with this block heap. No tracking information or heap structures are placed into the memory range.
init_track_mem Pointer to buffer of memory to use for initial tracking blocks for this heap. This may be NULL if no blocks are to be available at the start of the heap's usage.
init_track_mem_bytes Size of the buffer of memory to use for initial tracking blocks for this heap. This may be zero if no blocks are to be available at the start of the heap's usage.
optFlag Standard heap options.

Determining the Amount of Memory to Specify for Tracking

Use the macro MEM_BLKHEAP_TRACKING_BYTES to statically determine the number of bytes necessary to hold a group of a specific number of free tracking blocks.

Return Values

Handle to the new heap. If invalid arguments are used MEM_HEAP_INVALID_HANDLE is returned.

Description

Initializes a block heap for use, allowing an initial set of tracking blocks to be specified.

Do Not Call From

Multiple threads This function is not thread-safe.
Callbacks Do not call this function from any callback function.

See Also

MEMAddBlockHeapTracking
MEMAllocFromBlockHeap
MEMAllocFromBlockHeapAt
MEMAllocFromBlockHeapEx
MEMDestroyBlockHeap
MEMFreeToBlockHeap
MEMGetTrackingLeftInBlockHeap

Revision History

2013/05/08 Automated cleanup pass.
2010/11/01 Initial version.


CONFIDENTIAL