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 name="GENERATOR" content="Microsoft FrontPage 5.0"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 9<title>OSAlloc</title> 10</head> 11 12<body> 13 14<h1>OSAlloc</h1> 15 16 17<h2>C Specification</h2> 18 19<dl> 20<dd><pre><code>#include <revolution/os.h></code></pre> 21 </dd> 22<dd><pre><code>void* OSAlloc (u32 size);</code></pre> 23 </dd> 24</dl> 25 26<h2>Arguments</h2> 27<TABLE border="1" cellpadding="3" cellspacing="0.1"> 28 <tr> 29<TD width="120" bgcolor="#ffffe8"><em><strong><code><STRONG><EM><CODE>size</CODE></EM></STRONG></code></strong></em></TD> 30<TD width="520">Size of object to allocate.</TD> 31 </tr> 32</TABLE> 33<h2>Return Values</h2> 34 35<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. 36</p> 37<H2>Description</H2> 38<P>Although this function is provided for compatibility's sake, we recommend using the MEM library. </P> 39<P>Allocates <strong><code><em>size</em></code></strong> bytes from the current heap.</P> 40<P>You must use the <code><a href="OSInitAlloc.html">OSInitAlloc</a></code> and <CODE><A href="OSCreateHeap.html">OSCreateHeap</A></CODE> functions first to initialize the memory allocation feature and the <code><a href="OSCreateHeap.html">OSCreateHeap</a></code> function to create a heap. </P> 41 42 43 44<h2>See Also</h2> 45 46<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>,<a href="OSAllocFromHeap.html">OSAllocFromHeap</a></code>, <code><a href="OSFree.html">OSFree</a></code>, <a href="OSSetCurrentHeap.html"><code>OSSetCurrentHeap</code></a></p> 47<H2>Revision History</H2> 48<P>03/01/2006 Initial version.</P> 49</body> 50</html>