I am running this code compiled on 64 bits vC ++ 2005, on Windows Server 2008 R2 with 32 GB. 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 the new double [536870912], why do I get an access violation when performing a job at a specific position of the array?
Another point worth mentioning is that this program was successfully tested on another computer.
c ++ memory access-violation windows-server-2008-r2
Jordi
source share