I am trying to allocate a large block (5GB) of memory under Windows 7 Professional. I have a 64-bit machine and 16GB RAM and I'm using MS Visual Studio 10. For those of you who might ask why - its because I need to hold a 2-D raster representation of a map of reference numbers to polygon data, the maps can be up to 40,000 x 40,000 units. This has to go into RAM and fragmenting it into smaller blocks would be too expensive in runtimes.

So if I do this:

```
int _tmain(int argc, _TCHAR* argv[])
{
    int t = INT_MAX;
    int * test = new int[t/6];
    delete test;
    return 0;
}

```

The call to new fails, but
`int * test = new int[t/7];` succeeds.

Investigating a bit more I found that the memory allocation is only using the memory which is designated as 'free' by the resource monitor. So when this is smaller than the allocation requested the allocation fails. The resource monitor tells me that (when I looked) I had ~5GB in use, ~10GB on standby, and a little over 1GB free.

As far as I understand it this should not happen. Surely if memory is requested it should be taken from the standby memory? If this is not the case then is there a way to reduce the amount of standby memory used by windows from inside C++? 

The latter can be done outside C++ using RAMMap as I discovered from this post: [Clear the windows 7 standby memory programmatically](https://stackoverflow.com/questions/12841845/clear-the-windows-7-standby-memory-programmatically) but unfortunately there was no useful answer to the question of programatic clearing. Perhaps I am luckier in C++.

Of course the more likely scenario that I am just missing something obvious.

Thanks