MmAllocateNonCachedMemory - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// ntddk.h

PVOID MmAllocateNonCachedMemory(
  [in] SIZE_T NumberOfBytes
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-ntddk-mmallocatenoncachedmemory)

Description

The MmAllocateNonCachedMemory routine allocates a virtual address range of non-cached and cache-aligned memory.

Parameters

NumberOfBytes [in]

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.

Remarks

MmAllocateNonCachedMemory can be called from a DriverEntry routine to allocate a non-cached block of virtual memory for various device-specific buffers. The function always returns a full multiple of the virtual memory page size, of nonpaged system-address-space memory, regardless of the requested allocation size.

Non-cached allocations are aligned on an integral multiple of the processor's data-cache-line size to prevent cache and coherency problems.

The physical memory pages that MmAllocateNonCachedMemory returns are typically not contiguous pages.

Memory that MmAllocateNonCachedMemory allocates is uninitialized. A kernel-mode driver must first zero this memory if it is going to make it visible to user-mode software (to avoid leaking potentially privileged contents).

See also

AllocateCommonBuffer

KeGetDcacheFillSize

MmAllocateContiguousMemory

MmAllocateContiguousMemorySpecifyCache

MmFreeNonCachedMemory