MmFreeContiguousMemory routine

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

Syntax


VOID MmFreeContiguousMemory(
  _In_ PVOID BaseAddress
);

Parameters

BaseAddress [in]

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

Return value

None

Remarks

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.

Requirements

Target platform

Universal

Version

Available starting with Windows 2000.

Header

Ntddk.h (include Ntddk.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

See Remarks section.

DDI compliance rules

IrqlMmDispatch, HwStorPortProhibitedDDIs

See also

MmAllocateContiguousMemory
MmAllocateContiguousMemorySpecifyCache
MmAllocateContiguousMemorySpecifyCacheNode

 

 

Send comments about this topic to Microsoft

Show: