MmAllocateNonCachedMemory

PVOID
MmAllocateNonCachedMemory(

IN ULONG NumberOfBytes
);

MmAllocateNonCachedMemory allocates a virtual address range of noncached and cache-aligned memory.

Parameters

NumberOfBytes

Specifies the size in bytes of the range to be allocated.

Return Value

If the requested memory cannot be allocated, the return value is NULL. Otherwise, it is the base virtual address of the allocated range.

Comments

MmAllocateNonCachedMemory can be called from a DriverEntry routine to allocate a noncached block of virtual memory for various device-specific buffers.

A device driver that must use noncached 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. Noncached allocations are aligned on an integral multiple of the processor's data-cache-line size to prevent cache and coherency problems.

Callers of MmAllocateNonCachedMemory must be running at IRQL < DISPATCH_LEVEL.

See Also

HalAllocateCommonBuffer, KeGetDcacheFillSize, MmAllocateContiguousMemory, MmFreeNonCachedMemory