MmFreeContiguousMemory function (ntddk.h)

The MmFreeContiguousMemory routine releases a range of physically contiguous memory that was allocated by an MmAllocateContiguousMemoryXxx routine.


void MmFreeContiguousMemory(
  PVOID BaseAddress



[in] Pointer to the virtual address of the memory to be freed.

Return value



The MmFreeContiguousMemory routine frees a block of physically contiguous memory that was allocated by a previous call to the MmAllocateContiguousMemory, MmAllocateContiguousMemorySpecifyCache, or MmAllocateContiguousMemorySpecifyCacheNode routine. The BaseAddress parameter must be the base address that was obtained from the previous call to the MmAllocateContiguousMemoryXxx routine.

A device driver that must use contiguous memory should allocate only what it needs during driver initialization because physical memory is likely to become fragmented as the system runs. Such a driver must deallocate the memory when the driver is done using the memory.

Callers of MmFreeContiguousMemory must be running at IRQL = APC_LEVEL. For Windows Server 2008 and later versions of the Windows operating system, you can also call MmFreeContiguousMemory with IRQL <= DISPATCH_LEVEL. However, you can improve driver performance by calling at APC_LEVEL or below.


Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header ntddk.h (include Wdm.h, Ntddk.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL See Remarks section.
DDI compliance rules IrqlMmDispatch, HwStorPortProhibitedDDIs

See also