abort when malloc fails

This commit is contained in:
David Rose 2001-10-01 16:31:03 +00:00
parent 8a86a45e19
commit bfb9453f37

View File

@ -22,7 +22,12 @@
#ifndef NDEBUG
void *default_operator_new(size_t size) {
return malloc(size);
void *ptr = malloc(size);
if (ptr == (void *)NULL) {
cerr << "Out of memory!\n";
abort();
}
return ptr;
}
void default_operator_delete(void *ptr) {