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 http-equiv="Content-Style-Type" content="text/css">
6<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 8.0.0.0 for Windows">
7<TITLE>Functionality Common to the Different Heaps</TITLE>
8<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
9</HEAD>
10<BODY>
11
12<H1>Functionality Common to the Different Heaps</H1>
13<p>
14This section describes the functionality common among the expanded, frame, and unit heap.
15</p>
16
17<H2>Heap Options</H2>
18<p>
19Among the functions that can be used to create a heap, heap options can be specified using <A HREF="./ExpHeap/MEMCreateExpHeapEx.html"><CODE>MEMCreateExpHeapEx</CODE></A>, <A HREF="./FrmHeap/MEMCreateFrmHeapEx.html"><CODE>MEMCreateFrmHeapEx</CODE></A> and <A HREF="./UnitHeap/MEMCreateUnitHeapEx.html"><CODE>MEMCreateUnitHeapEx</CODE></A>. The following are options that can be specified.
20</p>
21
22<TABLE class="api_list" border="1">
23<CAPTION>Options That Can Be Specified During Heap Creation</CAPTION>
24<TR><TD><B>Flag</B></TD><TD><B>Content</B></TD></TR>
25<TR><TH><CODE><CODE>MEM_HEAP_OPT_0_CLEAR</CODE></CODE></TH><TD>The allocated memory block is filled with zeroes upon allocation from the heap.</TD></TR>
26<TR><TH><CODE><CODE>MEM_HEAP_OPT_DEBUG_FILL</CODE></CODE></TH><TD>When a heap is created and memory blocks are allocated and deallocated, this fills the memory regions respectively with different 32-bit values.</TD></TR>
27<TR><TH><CODE><CODE>MEM_HEAP_OPT_THREAD_SAFE</CODE></CODE></TH><TD>Enables exclusive processing between threads.</TD></TR>
28</TABLE>
29
30<p>
31The <CODE>MEM_HEAP_OPT_DEBUG_FILL</CODE> flag is used for debugging. Use this flag to find memory access bugs by tracing the pointer that points to the memory initialization failure or invalid memory regions. This flag will not function in the final ROM (FINALROM) version of the library. The following values fill in memory regions by default. See the next section to learn how to change these values.
32</p>
33<UL>
34<LI>At time of heap creation: <CODE>0xC3C3C3C3</CODE>
35<LI>At time of memory allocation: <CODE>0xF3F3F3F3</CODE>
36<LI>At time of memory deallocation: <CODE>0xD3D3D3D3</CODE>
37</UL>
38
39<H2>Changing Fill Values for Debugging</H2>
40<p>
41By specifying the <CODE>MEM_HEAP_OPT_DEBUG_FILL</CODE> flag when creating the heap, the memory region can be filled with a different 32-bit value during heap creation, memory block allocation and deallocation, respectively. This fill value can be modified. You can set and get the fill values using the following functions.
42</p>
43
44<TABLE class="api_list" border="1">
45<CAPTION>Functions for Setting and Getting Debug Fill Values</CAPTION>
46<TR><TD><B>Functions</B></TD><TD><B>Features</B></TD></TR>
47<TR><TH><A HREF="./Heap/MEMSetFillValForHeap.html"><CODE>MEMSetFillValForHeap</CODE></A></TH><TD>Sets fill values.</TD></TR>
48<TR><TH><A HREF="./Heap/MEMGetFillValForHeap.html"><CODE>MEMGetFillValForHeap</CODE></A></TH><TD>Gets fill values.</TD></TR>
49</TABLE>
50
51<p>
52Different values can be set when heaps are created, memory blocks are allocated, and memory blocks are freed. When you set or get values, the heap operation the values are specific to is set. The following table shows the types of heap operations specified in the function.
53</p>
54
55<TABLE class="api_list" border="1">
56<CAPTION>Types of Heap Operations for Fill Values</CAPTION>
57<TR><TD><B>Value Specified in the Function</B></TD><TD><B>Heap Operation</B></TD></TR>
58<TR><TH><CODE><CODE>MEM_HEAP_FILL_NOUSE</CODE></CODE></TH><TD>At heap creation.</TD></TR>
59<TR><TH><CODE><CODE>MEM_HEAP_FILL_ALLOC</CODE></CODE></TH><TD>At memory block allocation.</TD></TR>
60<TR><TH><CODE><CODE>MEM_HEAP_FILL_FREE</CODE></CODE></TH><TD>At memory block freeing.</TD></TR>
61</TABLE>
62
63<H2>Displaying Heap Content</H2>
64<p>
65This feature for displaying the content of the heap is for debugging. The following functions accomplish this.
66</p>
67
68<TABLE class="api_list" border="1">
69<CAPTION>Functions that Display Internal Heap Data</CAPTION>
70<TR><TD><B>Functions</B></TD><TD><B>Features</B></TD></TR>
71<TR><TH><A HREF="./Heap/MEMDumpHeap.html"><CODE>MEMDumpHeap</CODE></A></TH><TD>Displays internal heap data.</TD></TR>
72</TABLE>
73
74<H2>Getting Heap Regions</H2>
75<p>
76This feature obtains the start and end address of memory regions used by the heaps. The following functions accomplish this.
77</p>
78
79<TABLE class="api_list" border="1">
80<CAPTION>Functions for Getting the Heap Region</CAPTION>
81<TR><TD><B>Functions</B></TD><TD><B>Features</B></TD></TR>
82<TR><TH><A HREF="./Heap/MEMGetHeapStartAddress.html"><CODE>MEMGetHeapStartAddress</CODE></A></TH><TD>Gets the starting address of the memory region used by the heap.</TD></TR>
83<TR><TH><A HREF="./Heap/MEMGetHeapEndAddress.html"><CODE>MEMGetHeapEndAddress</CODE></A></TH><TD>Gets the ending address + 1 of the memory region used by the heap.</TD></TR>
84</TABLE>
85
86<H2>Revision History</H2>
87<P>
882006/03/01 Initial version.<BR>
89</P>
90<hr><p>CONFIDENTIAL</p></body>
91</HTML>
92