The MmFreeContiguousMemory routine releases a range of physically contiguous memory that was allocated with MmAllocateContiguousMemory.
VOID
MmFreeContiguousMemory(
IN PVOID BaseAddress
);
None
Declared in ntddk.h. Include ntddk.h.
This routine is the reciprocal of MmAllocateContiguousMemory, and is usually called only when a driver is being unloaded. The input BaseAddress must have been returned by a preceding call to MmAllocateContiguousMemory.
A device driver that must use contiguous memory should allocate only what it needs during driver initialization because nonpaged pool is likely to become fragmented as the system runs. Such a driver must deallocate the memory if it is unloaded.
Callers of MmFreeContiguousMemory must be running at IRQL <= PASSIVE_LEVEL.