I'm running this code, compiled on 64 bits vc++ 2005, on Windows Server 2008 R2 with 32GB. There is an access violation inside the for loop.
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
double *x = new double[536870912];
cout << "memory allocated" << endl;
for(long int i = 0; i < 536870912; i++)
{
cout << i << endl;
x[i] = 0;
}
delete [] x;
return 0;
}
So if there is no exception in new double[536870912], why am I getting an access violation when doing an assignment over a particular array position?
Another point worth mentioning is that this program was succesfully tested on another computer.
It is probably one of the following problem:
I suggest you to test the following code:
Editing: Using this code, i just achieved allocate a single block of 9GB.