// C syntax
#include <vmm.h>
ULONG EXTERN _HeapAllocate(ULONG nbytes, ULONG flags);
; assembler syntax
include vmm.inc
VMMCall _HeapAllocate, <nbytes, flags>
or eax, eax ; zero if error
jz not_allocated
mov [Address], eax ; address of memory block
Allocates a block of memory from the system heap. Uses EAX, ECX, EDX, and flags.
Value | Meaning |
---|---|
HEAPLOCKEDIFDP | Allocates a memory block in locked memory only if MS-DOS or BIOS functions are used for paging. Otherwise, the memory block is allocated in pageable memory. |
HEAPINIT | Allocates a memory block that is automatically freed after initialization. This value can only be specified during initialization. |
HEAPSWAP | Allocates a memory block in pageable memory. |
HEAPZEROINIT | Fills the memory block with zeros. If this value is not given, the initial content of the memory block is undefined. |
All other values are reserved.
Only one of the values HEAPINIT, HEAPSWAP, or HEAPLOCKEDIFDP can be specified. If none of these values is specified, the block is allocated in fixed memory.
This service aligns allocated block on doubleword boundaries, however, the block size does not have to be a multiple of 4.
Since the system offers no protection on the heap, virtual devices must provide their own protection to prevent overrunning allocated blocks.
The system offers no compaction on the heap; all memory blocks on the heap are fixed. Virtual devices must not to use the heap in such a way as to severely fragment it.
_HeapFree, _HeapReAllocate