Virtual Devices (3.1) (vdag31qh.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
_HeapAllocate
                                                     Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
include vmm.inc
 
VMMcall _HeapAllocate, <nbytes, flags>
 
or      eax, eax            ; zero if error
jz      not_allocated
mov     [Address], eax      ; address of memory block
 
The _HeapAllocate service allocates a block of memory from the heap.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
nbytes     Specifies the size in bytes of the block to allocate. This
           parameter must not be zero.
 
flags      Specifies the allocation flags. It can be the following value:
 
           Value         Meaning
           ─────────────────────────────────────────────────────────────────
           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.
 
Return Value
 
The EAX register contains the ring-0 address of the block if the service is
successful. Otherwise, EAX contains zero to indicate an error such as
insufficient memory to satisfy the request.
 
Comments
 
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.
 
Uses
 
EAX
 
See Also
 
_HeapFree, _HeapReAllocate