OS_CreateHeap

C Specification

#include <nitro/os.h>
OSHeapHandle OS_CreateHeap( OSArenaId id, void* start, void* end ); 

Arguments

id The arena ID of an arena in which you are going to create a heap.
start Starting address of heap region
end Ending address of address of heap region (+1)

Return Values

In the case that it was possible to create a heap, a value of 0 or greater will be returned, which is the handle to the heap. In the case that it was not possible to create a heap, a  -1 is returned.

Description

This function creates a heap in the specified arena.

The arena is specified with the arena ID (id). To read more about this value, see OS_InitArena(). The arena must have memory allocated with the OS_InitAlloc function and then be initialized in advance. The region for the heap is from start to end. The end address is +1 from the actual end position.

OS_CreateHeap( OS_ARENA_MAIN, (void*)0x2030000, (void*)0x2040000 );

In thi example, the 0x10000 bytes from 0x2030000 – 0x203FFFF are used as the heap region.

See Also

OS_InitArena, OS_InitAlloc

Revision History

01/06/2004 Initial version