not able to allocate more than 2047MB memory chunk

Hi All,

Environment :

virtual machine of Windows 10 IOT x64

Visual studio 2017 community edition

project type : windows driver → Legacy → WDM driver

RAM size : 5 GB

Trying to allocate more than 2Gb of memory chunk in physical memory, able to allocate 2047 MB of memory chunk but it fails to allocate any chunk greater that 2047 MB.

but as per Microsoft, on Windows 64-bit architecture we can assign non paged memory up to 75% of RAM or 128 GB
(Whichever is lower)

sample source code is as follows:

#include “ntddk.h”

PVOID AllocatedMemory = NULL;



            NTSTATUS status = STATUS_SUCCESS;

            DriverObject->DriverUnload = Unload;

            AllocatedMemory = ExAllocatePoolWithTag(NonPagedPool, 2048 * 1024 * 1024, 'Tag1');

            if (AllocatedMemory != NULL)


                            KdPrint(("2048 MB NonCachedMemory is allocated. \r\n"));




                            KdPrint(("2048 MB NonCachedMemory is not allocated. \r\n"));


            return status;


VOID Unload(PDRIVER_OBJECT DriverObject)


            if (AllocatedMemory != NULL)


                            ExFreePoolWithTag(AllocatedMemory, 'Tag1');

                            KdPrint(("2048 MB NonCachedMemory is freed. \r\n"));



please suggest how can memory chunk more than 2 GB can be allocated.

Thank You

on Windows 64-bit architecture we can assign non paged memory up to 75% of RAM or 128 GB

So what??? Even if you have assigned 75% of RAM (i.e 3750 MB in your case) to non-paged pool it does not necessarily imply that all this memory is going to be available to your driver. What about the other drivers that allocate non-paged memory? There is a good chance that 2047 MB of RAM is all that is left in the pool by the time you attempt your allocation. It never occurred to you to think this way, did it…

KdPrint((“2048 MB NonCachedMemory is allocated. \r\n”));

…and, once we are at it, NonCachedMemory and non-paged pool are totally unrelated concepts anyway…

Anton Bassov

It is confirmed from the windbg (!vm extension) and task manager that sufficient non paged memory is available at the time of memory allocation and also while trying to allocate two chunks of 2047 MB each the memory allocation becomes successful.
Also while trying to allocate the paged memory the same limitation occurred, 2047 MB memory allocated successfully but failed to allocate any chunk greater than 2047 MB.