#include #include using std::cout; using std::endl; int main(int argc, char** argv) { int i = 0; while (1) { try { cout << "Alloc " << ++i << endl; new int [0x40000]; } catch(std::bad_alloc b) { cout << "failed to allocate memory" << endl; cout << "exception caught " << b.what() << endl; break; } } return 0; }