StorPortAllocateContiguousMemorySpecifyCacheNode Always fails!!!

I am trying to allocate 512MB of memory using StorPortAllocateContiguousMemorySpecifyCacheNode on Windows 7, but it always fails with insufficient memory error. Even though I have 16GB of RAM, out of which enough “Free Physical Memory” is available.

The strange part is on Windows 10, I am able to allocate 512MB with 16GB of RAM.

Any advice would be appreciated.

Note : it is a normal desktop PC not a server, It just has only one node.

Why do you need contiguous memory? It doesn’t take very long for physical memory in a system to become quite fragmented, and it’s not at all unusual that 512MB of contiguous space would not be available.

We are doing some experiment with our SSD. Host driver supposed to give large memory region to Device. So we are trying to allocate physically contiguous-Non paged memory.

The whole experiment is also done on a fresh system after the system restart, so we had enough free Physical memory as per task manager. Since we didn’t run any other applications so fragmentation would be ideally less we believe.

It isn’t just programs that fragment memory. In Windows 7 you still had a limited amount of kernel memory you could allocate, and the kernel would fragment quickly. I did this on a Windows 7 system for a custom driver (not a storport) but to be reliable, I had to make it one of the earliest drivers loaded, and immediately allocate the memory.