diff options
| author | Jesse Jones <jesse9jones@gmail.com> | 2012-12-11 19:16:00 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-12-15 22:38:20 -0800 |
| commit | 0402360abb95b4b9930ac74cf04bb22f343396e1 (patch) | |
| tree | 1d5892ce6bbbeae703bca6eca26793ddf0c5b4ac /src/rt/util/array_list.h | |
| parent | e8d2d559002d6f1cb0a12553674b9b0383224512 (diff) | |
| download | rust-0402360abb95b4b9930ac74cf04bb22f343396e1.tar.gz rust-0402360abb95b4b9930ac74cf04bb22f343396e1.zip | |
Abort instead of throwing on oom
Diffstat (limited to 'src/rt/util/array_list.h')
| -rw-r--r-- | src/rt/util/array_list.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rt/util/array_list.h b/src/rt/util/array_list.h index eef46856b1b..41d614d0b2d 100644 --- a/src/rt/util/array_list.h +++ b/src/rt/util/array_list.h @@ -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; } |
