Previous Next

MmFreeContiguousMemory

The MmFreeContiguousMemory routine releases a range of physically contiguous memory that was allocated with MmAllocateContiguousMemory.

VOID 
  MmFreeContiguousMemory(
    IN PVOID  BaseAddress
    );

Parameters

BaseAddress
Pointer to the virtual address of the memory to be freed.

Return Value

None

Headers

Declared in ntddk.h. Include ntddk.h.

Comments

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.

See Also

MmAllocateContiguousMemory