Skip to content

Commit

Permalink
Abort instead of throwing on oom
Browse files Browse the repository at this point in the history
  • Loading branch information
jesse99 authored and brson committed Dec 16, 2012
1 parent e8d2d55 commit 0402360
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/rt/util/array_list.h
Expand Up @@ -72,8 +72,10 @@ array_list<T>::push(T value) {
if (_size == _capacity) {
size_t new_capacity = _capacity * 2;
void* buffer = realloc(_data, new_capacity * sizeof(T));
if (buffer == NULL)
throw std::bad_alloc();
if (buffer == NULL) {
fprintf(stderr, "array_list::push> Out of memory allocating %ld bytes", new_capacity * sizeof(T));
abort();
}
_data = (T *) buffer;
_capacity = new_capacity;
}
Expand Down

0 comments on commit 0402360

Please sign in to comment.