1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3
4<HEAD>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META http-equiv="Content-Style-Type" content="text/css">
7<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 8.0.0.0 for Windows">
8
9<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
10
11	<TITLE>MEMCreateUnitHeapEx</TITLE>
12
13</HEAD>
14
15<BODY>
16
17<H1>MEMCreateUnitHeapEx</H1>
18
19
20<H2>C Specification</H2>
21<PRE class="construction">#include &lt;revolution/mem.h&gt;
22
23MEMHeapHandle MEMCreateUnitHeapEx(
24	void*   startAddress ,
25	u32     heapSize,
26	u32     memBlockSize,
27	u32     alignment,
28	u16     optFlag );</PRE>
29
30
31<H2>Arguments</H2>
32<TABLE border="1">
33
34    <TR>
35	<TD>startAddress</TD>
36	<TD>Start address of the allocated memory region in the heap.</TD>
37</TR>
38    <TR>
39<TD>heapSize</TD>
40<TD>Size in bytes of the memory region allocated to the heap.</TD>
41    </TR>
42    <TR>
43<TD>memBlockSize</TD>
44<TD>Size of memory block in bytes.</TD>
45    </TR>
46    <TR>
47<TD>alignment</TD>
48<TD>Memory block alignment. Specify the following values: 4, 8, 16, 32.</TD>
49    </TR>
50    <TR>
51<TD>optFlag</TD>
52<TD>Heap options (explained below).</TD>
53    </TR>
54  </TABLE>
55
56
57<H2>Return Values</H2>
58<P>Returns the heap handle when a heap can be created. Returns <CODE>MEM_HEAP_INVALID_HANDLE</CODE> (a <CODE>NULL</CODE> value) if a heap can't be created.</P>
59<H2>Description</H2>
60<P>Creates the unit heap. The heap region is a memory region that has a size specified by <code>heapSize</code> and a start address specified by <code>startAddress</code>.</P>
61<P>Each memory block has a fixed size specified by <code>memBlockSize</code>. Each memory block has an alignment specified by <code>alignment</code> with 4, 8, 16, and 32 as possible values.</P>
62<P>Heap options can be specified with <code>optFlag</code>.</P>
63<TABLE border="1">
64  <TBODY>
65    <TR>
66<TD><CODE>MEM_HEAP_OPT_0_CLEAR</CODE></TD>
67<TD>The allocated memory block is filled with zeroes upon allocation from the heap.</TD>
68    </TR>
69    <TR>
70<TD><CODE>MEM_HEAP_OPT_DEBUG_FILL</CODE></TD>
71<TD>Upon heap creation or whenever memory blocks are allocated or freed, each is filled with different 32-bit values in the memory region. This flag is used for debugging to find memory access bugs caused by either a failure to initialize memory or invalid memory regions. This option is not valid for the <code>FINALROM</code> version of the library.</TD>
72    </TR>
73    <TR>
74<TD><CODE>MEM_HEAP_OPT_THREAD_SAFE</CODE></TD>
75<TD>Enables exclusive processing between threads.</TD>
76    </TR>
77  </TBODY>
78</TABLE>
79<H2>See Also</H2>
80<P class="reference">
81<A href="MEMCreateUnitHeap.html"><CODE>MEMCreateUnitHeap</CODE></A>
82</P>
83
84
85<H2>Revision History</H2>
86<P>03/01/2006 Initial version.</P>
87
88
89</BODY>
90</HTML>
91