about summary refs log tree commit diff
path: root/src/rt/util/array_list.h
diff options
context:
space:
mode:
authorJesse Jones <jesse9jones@gmail.com>2012-12-11 19:16:00 -0800
committerBrian Anderson <banderson@mozilla.com>2012-12-15 22:38:20 -0800
commit0402360abb95b4b9930ac74cf04bb22f343396e1 (patch)
tree1d5892ce6bbbeae703bca6eca26793ddf0c5b4ac /src/rt/util/array_list.h
parente8d2d559002d6f1cb0a12553674b9b0383224512 (diff)
downloadrust-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.h6
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;
     }