1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" /> 7<title>Allocate</title> 8 </head> 9 <body> 10<h1><CODE>nn::fnd::ExpHeapTemplate::Allocate</CODE> Member Function</h1> 11<h2>Syntax</h2> 12 <div class="section"> 13 <pre class="definition"> 14void * Allocate( 15 size_t byteSize, 16 s32 alignment = DEFAULT_ALIGNMENT, 17 bit8 groupId = 0, 18 <a href="../../../nn/fnd/ExpHeapBase/AllocationMode.html">AllocationMode</a> mode = ALLOCATION_MODE_FIRST_FIT, 19 bool reuse = false 20); 21</pre> 22 </div> 23<h2>Arguments</h2> 24 <div class="section"> 25 <table class="arguments"> 26 <thead> 27 <tr> 28 <td width="15" /> 29<th>Name</th> 30<td>Description</td> 31 </tr> 32 </thead> 33 <tr> 34<td>in</td> 35<th>byteSize</th> 36<td>Specifies the size (in bytes) of the memory block to allocate.</td> 37 </tr> 38 <tr> 39<td>in</td> 40<th>alignment</th> 41<td>Specifies the alignment. You can specify a power of two between -128 and 128 with an absolute value of 4 or greater.</td> 42 </tr> 43 <tr> 44<td>in</td> 45<th>groupId</th> 46<td>Specifies the group ID.</td> 47 </tr> 48 <tr> 49<td>in</td> 50<th>mode</th> 51<td>Specifies the mode to use for memory block allocation.</td> 52 </tr> 53 <tr> 54<td>in</td> 55<th>reuse</th> 56<td>Specifies whether to reuse the gaps in memory that occur during alignment.</td> 57 </tr> </table> 58 </div> 59<h2>Return Values</h2> 60<div class="section">Returns the starting address of the allocated memory block. </div> 61<h2>Description</h2> 62 <div class="section"> 63<p>Allocates memory from the expanded heap.</p><p>The following values can be specified in alignment: -128, -64, -32, -16, -8, -4, 4, 8, 16, 32, 64, and 128.</p><p>This function starts searching at the beginning of the heap if <SPAN class="argument">alignment</SPAN> is positive or at the end of the heap if <SPAN class="argument">alignment</SPAN> is negative and then allocates the free region that it finds.</p><!-- write here --></div> 64<h2>Revision History</h2> 65 <div class="section"> 66 <dl class="history"> 67 <dt>2010/10/27</dt> 68<dd>Because a problem with memory leak was discovered when values greater than 128 was specified with alignment, the value range was restored to -128 to 128.<br /> 69 </dd> 70 <dt>2010/09/17</dt> 71<dd>Changed the values that can be specified for <SPAN class="argument">alignment</SPAN> to the range between <CODE>-4096</CODE> and <CODE>4096</CODE>. Added information on the meanings of positive and negative <SPAN class="argument">alignment</SPAN> values. 72 </dd> 73 <dt>2010/05/21</dt> 74<dd>Changed valid values for <SPAN class="argument">alignment</SPAN> to <CODE>-128</CODE> through <CODE>128</CODE>.<br /> 75 </dd> 76 <dt>2010/01/07</dt> 77<dd>Initial version.<br /> 78 </dd> 79 </dl> 80 </div> 81 <hr><p>CONFIDENTIAL</p></body> 82</html>