Virtual alloc fail

Hello,
I can't understand why my virtual alloc fails when i want to allocate more than a GiB. I thought that virtual memory makes the physical memory transparent and so on 64b i can allocate any amount i want, but i still get the no address failure 487 when i pass 0 to the base address.
Are you sure you are running code as 64-bit not 32-bit?
Are you sure you are passing 0 in first argument (lpAddress)?
Yes, on both accounts.
Then there is no way VirtualAlloc will return 487 error. Something else is wrong with your code.

Post minimal code that reproduces issue. Ideally only WinMain function with call to VirtualAlloc function + error check and nothing else.

Edited by Mārtiņš Možeiko on
The only thing I can think of is if the Virtual memory address space has been fragmented such that there is no contiguous block available. This would be very unusual, I think.

- tim