Skip to content

Commit 0402360

Browse files
jesse99brson
authored andcommitted
Abort instead of throwing on oom
1 parent e8d2d55 commit 0402360

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rt/util/array_list.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ array_list<T>::push(T value) {
7272
if (_size == _capacity) {
7373
size_t new_capacity = _capacity * 2;
7474
void* buffer = realloc(_data, new_capacity * sizeof(T));
75-
if (buffer == NULL)
76-
throw std::bad_alloc();
75+
if (buffer == NULL) {
76+
fprintf(stderr, "array_list::push> Out of memory allocating %ld bytes", new_capacity * sizeof(T));
77+
abort();
78+
}
7779
_data = (T *) buffer;
7880
_capacity = new_capacity;
7981
}

0 commit comments

Comments
 (0)