1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.1.0 for Windows"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<TITLE>OS_CreateHeap</TITLE> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</HEAD> 10<BODY> 11<H1 align="left">OS_CreateHeap <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></H1> 12<H2>Syntax</H2> 13<DL> 14 <DD> 15<PRE><CODE>#include <nitro/os.h></CODE></PRE> 16<PRE><CODE>OSHeapHandle OS_CreateHeap( OSArenaId id, void* start, void* end ); </CODE></PRE> 17</DL> 18<H2>Arguments</H2> 19<TABLE border="1" width="100%"> 20 <TBODY> 21 <TR> 22<TD width="13%"><CODE>id</CODE></TD> 23<TD width="87%">Arena ID of an arena in which you are going to create a heap</TD> 24 </TR> 25 <TR> 26<TD><CODE>start</CODE></TD> 27<TD>Starting address of heap region</TD> 28 </TR> 29 <TR> 30<TD><CODE>end</CODE></TD> 31<TD>Ending address of address of heap region (+1)</TD> 32 </TR> 33 </TBODY> 34</TABLE> 35<H2>Return Values</H2> 36<P>In the case that it was possible to create a heap, the handle to the heap will be returned. In the case that it was not possible to create a heap, -1 is returned.</P> 37<H2>Description</H2> 38<P>Creates a heap in the specified arena.</P> 39<P>The arena is specified with the arena ID (<CODE>id</CODE>). To read more about this value, see the <a href="../arena/OS_InitArena.html"><code>OS_InitArena</code></a> function. The arena must have memory allocated with the <CODE>OS_InitAlloc</CODE> function and then be initialized in advance. The region for the heap is from <CODE>start</CODE> to <CODE>end</CODE>. The <CODE>end</CODE> address is +1 from the actual end position.</P> 40<BLOCKQUOTE><CODE>OS_CreateHeap( OS_ARENA_MAIN, (void*)0x2030000, (void*)0x2040000 );</CODE></BLOCKQUOTE> 41<P>In this example, the <CODE>0x10000</CODE> bytes from <CODE>0x2030000</CODE> to <CODE>0x203FFFF</CODE> are used as the heap region.</P> 42<P>Call the <a href="OS_DestroyHeap.html"><code>OS_DestroyHeap</code></a> function to destroy created heaps.</P> 43<P>Call the <a href="OS_ClearHeap.html"><code>OS_ClearHeap</code></a> function to reinitialize a heap.</P> 44<H2>See Also</H2> 45<P><A href="../arena/OS_InitArena.html"><CODE>OS_InitArena</CODE></A><BR> <A href="OS_InitAlloc.html"><CODE>OS_InitAlloc</CODE></A><BR> <A href="OS_DestroyHeap.html"><CODE>OS_DestroyHeap</CODE></A><BR> <A href="OS_ClearHeap.html"><CODE>OS_ClearHeap</CODE></A></P> 46<H2>Revision History</H2> 47<P>2004/01/06 Initial version.</P> 48<hr><p>CONFIDENTIAL</p></body> 49</HTML>