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>MEMAllocFromExpHeapEx</TITLE> 12 13</HEAD> 14 15 16<BODY> 17 18 19<H1>MEMAllocFromExpHeapEx</H1> 20 21<H2>Syntax</H2> 22<DL><DD><PRE class="construction"> 23#include <revolution/mem.h> 24 25void* MEMAllocFromExpHeapEx( 26 MEMHeapHandle heap, 27 u32 size, 28 int alignment ); 29</PRE></DD></DL> 30 31<H2>Arguments</H2> 32<TABLE class="arguments" border="1"> 33 <TR> 34<TH>heap</TH> 35<TD>Expanded heap handle</TD> 36 </TR> 37 <TR> 38<TH>size</TH> 39<TD>Size of the memory block in bytes</TD> 40 </TR> 41 <TR> 42<TH>alignment</TH> 43<TD>Memory block alignment. The following values can be specified: 4, 8, 16, 32, 64, 128, -4, -8, -16, -32, -64, -128.</TD> 44 </TR> 45</TABLE> 46 47<H2>Return Values</H2> 48<P>When the memory block is allocated, the start address of this memory block is returned. When memory cannot be allocated, <CODE>NULL</CODE> is returned. </P> 49 50<H2>Description</H2> 51<P>Allocates a memory block from the expanded heap. Memory block alignment is specified by <SPAN class="argument">alignment</SPAN>. If the alignment is a negative value, the memory block is allocated from the top of the free region in the heap.</P> 52 53<P> 54The gap in memory caused by alignment is set by default to not be reused.<br>Use the <A href="MEMUseMarginOfAlignmentForExpHeap.html">MEMUseMarginOfAlignmentForExpHeap</A> function to change this setting so that so that this alignment gap, or margin, can be reused as an free memory region. However, note that performance may be adversely affected if you specify an alignment value of 32 or more or -32 or less when you allocate memory because tiny free blocks will be registered whenever small gaps arise between memory blocks.<BR> 55</P> 56 57<P>If the memory block is allocatable, the actual size of the memory block may be greater than the specified size. To determine the actual allocated size in bytes, use the <A href="MEMGetSizeForMBlockExpHeap.html"><CODE>MEMGetSizeForMBlockExpHeap</CODE></A> function.</P> 58 59<H2>See Also</H2> 60<P class="reference"> 61<A href="MEMAllocFromExpHeap.html">MEMAllocFromExpHeap</A>, 62<A href="MEMFreeToExpHeap.html">MEMFreeToExpHeap</A>, 63<A href="MEMCreateExpHeap.html">MEMCreateExpHeap</A>, 64<A href="MEMCreateExpHeapEx.html">MEMCreateExpHeapEx</A>, 65<A href="MEMUseMarginOfAlignmentForExpHeap.html">MEMUseMarginOfAlignmentForExpHeap</A> 66 67</P> 68 69<H2>Revision History</H2> 70<P> 712008/05/20 Changed the policy regarding use of gaps in alignment.<BR> 2006/03/01 Initial release.<BR> 72</P> 73 74<hr><p>CONFIDENTIAL</p></body> 75</HTML> 76