#include <iostream>
#include <new>
using namespace std;
int main()
{
double *p;
// this will eventually run out of memory
do {
try {
p = newdouble[100000];
} catch (bad_alloc xa) {
cout << "Allocation failure.\n";
return 1;
}
cout << "Allocation OK.\n";
} while(p);
return 0;
}