On Mar 3, 2011, at 2:21 PM, "Michael D. Berger" m_d_berger_1900@yahoo.com wrote:
In a context where exceptions are caught, I ran the fragment:
cerr << "allocating" << endl; char* arr[100]; for (int jj = 0; jj < 10; ++jj) { cerr << "jj = " << jj << endl; arr[jj] = new char[2000000000]; sleep (30); } sleep (10); for (int jj = 0; jj < 10; ++jj) delete[] arr[jj]; cerr << "deleted" << endl;
The exception was caught with jj = 1, i.e., on the second allocation.
In 32-bit a process can only allocate 3GB, 1GB is reserved for the kernel.
I don't know what your trying to do, but I'm sure your could do it a whole lot better the pre-allocating all available memory.
Don't go by top it only shows committed memory, not reserved.
-Ross