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="Microsoft FrontPage 5.0">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
8<TITLE>OSAllocFromHeap</TITLE>
9</HEAD>
10<BODY>
11<H1>OSAllocFromHeap</H1>
12<H2>C Specification</H2>
13<DL>
14  <DD>
15<PRE><CODE>#include &lt;revolution/os.h&gt;</CODE></PRE>
16  <DD>
17<PRE><code>void* OSAllocFromHeap (OSHeapHandle heap, u32 size);</code></PRE>
18</DL>
19<H2>Arguments</H2>
20<TABLE border="1" cellpadding="3" cellspacing="0.1">
21  <TBODY>
22    <TR>
23<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE><STRONG><EM><CODE>heap</CODE></EM></STRONG></CODE></STRONG></EM></TD>
24<TD width="520">Heap handle that was returned from the <a href="OSCreateHeap.html"><code>OSCreateHeap</code></a> function.</TD>
25    </TR>
26    <TR>
27<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE><STRONG><EM><CODE>size</CODE></EM></STRONG></CODE></STRONG></EM></TD>
28<TD width="520">Size of object to allocate.</TD>
29    </TR>
30  </TBODY>
31</TABLE>
32<H2>Return Values</H2>
33<P>Returns a null pointer if allocation is unsuccessful. Returns a pointer to the allocated region aligned to a 32-byte boundary if allocation is successful.</P>
34<H2>Description</H2>
35<P>Although this function is provided for compatibility's sake, we recommend using the MEM library.  </P>
36<P>Allocates <strong><code><em>size</em></code></strong> bytes from the heap that <code><em><strong>heap</strong></em></code> specifies. Some additional heap region will be consumed. This consumed region overwrites the heap selected by the <code><a href="OSSetCurrentHeap.html">OSSetCurrentHeap</a></code> function for allocation to occur.</P>
37<P>The memory allocation process must be initialized by the <code><a href="OSInitAlloc.html">OSInitAlloc</a></code> function first.</P>
38
39<H2>See Also</H2>
40<P><a href="../list.html#Memory Allocation" target="contents">Memory Allocation Functions</a>, <code><a href="OSInitAlloc.html">OSInitAlloc</a>,<a href="OSCreateHeap.html">OSCreateHeap</a></code>, <a href="OSFreeToHeap.html"><code>OSFreeToHeap</code></a></P>
41<H2>Revision History</H2>
42<P>03/01/2006 Initial version.</P>
43</BODY>
44</HTML>