Allocates the specified number of bytes from the heap
_MemGlobalAlloc ( $iBytes [, $iFlags = 0] )
|$iBytes||The number of bytes to allocate. If this parameter is zero and the $iFlags parameter specifies
$GMEM_MOVEABLE, the function returns a handle to a memory object that is marked as discarded.
|$iFlags||[optional] The memory allocation attributes:
$GMEM_FIXED - Allocates fixed memory. The return value is a pointer.
$GMEM_MOVEABLE - Allocates movable memory. Memory blocks are never moved in physical memory, but they can be moved within the default heap.
The return value is a handle to the memory object.
To translate the handle into a pointer, use the _MemGlobalLock() function.
This value cannot be combined with $GMEM_FIXED.
$GMEM_ZEROINIT - Initializes memory contents to zero
$GHND - Combines $GMEM_MOVEABLE and $GMEM_ZEROINIT
$GPTR - Combines $GMEM_FIXED and $GMEM_ZEROINIT
|Success:||a handle to the newly allocated memory object.|
Windows memory management does not provide a separate local heap and global heap.
If this function succeeds, it allocates at least the amount of memory requested.
If the actual amount allocated is greater than the amount requested, the process can use the entire amount.
To determine the actual number of bytes allocated, use the _MemGlobalSize() function.
If the heap does not contain sufficient free space to satisfy the request, this function returns NULL.
Memory allocated with this function is guaranteed to be aligned on an 8 byte boundary.
To execute dynamically generated code, use the _MemVirtualAlloc() function to allocate memory and the _Mem_VirtualProtect() function to grant $PAGE_EXECUTE access.
To free the memory, use the _MemGlobalFree() function.
_MemGlobalFree, _MemGlobalLock, _MemGlobalSize, _MemVirtualAlloc
Search GlobalAlloc in MSDN Library.