_PageFree


// C syntax
#include <vmm.h>

ULONG EXTERN _PageFree(PVOID hMem, DWORD flags);

// assembler syntax
include vmm.inc

VMMcall _PageFree, <hMem, flags>
or      eax, eax        ; nonzero if freed, zero if error
jz      failed

Frees the specified memory block. Uses EAX.

hMem

Base linear address of the memory block to free. This value must have been returned by the _PageAllocate, _PageReAllocate, or _PageReserve service. You may not free only part of a memory block.

flags

Operation flags. Can be zero or PR_STATIC, which specifies that the memory block being freed was allocated as PC_STATIC. If the memory block was allocated as PC_STATIC, but the PR_STATIC field is not also specified, the free will fail..

Virtual devices that allocate PG_VM or PG_HOOKED pages must free these pages when the associated virtual machine is destroyed. PG_SYS pages do not need to be freed when Windows exits.

If a virtual device maps a memory block into the V86 address space (using the _MapIntoV86 service), it should unmap the memory block before attempting to free it.

It is not an error to free memory which is all or partially locked.

It is not necessary to decommit the memory inside a memory block before freeing it. Freeing a memory block automatically decommits its contents.

See also _PageAllocate, _PageReAllocate