diff --git a/gi/arg.cpp b/gi/arg.cpp
index 77de0760..cc36c4c8 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -589,7 +589,9 @@ gjs_array_from_strv(JSContext             *context,
      * the case.
      */
     for (i = 0; strv != NULL && strv[i] != NULL; i++) {
-        elems.growBy(1);
+        if (!elems.growBy(1)) {
+            g_error("out of memory in gjs_array_from_strv");
+        }
         if (!gjs_string_from_utf8(context, strv[i], -1, elems[i]))
             return false;
     }
@@ -974,7 +976,10 @@ gjs_array_from_flat_gvalue_array(JSContext             *context,
     GValue *values = (GValue *)array;
     unsigned int i;
     JS::AutoValueVector elems(context);
-    elems.resize(length);
+    if (!elems.resize(length)) {
+        g_error("unable to resize vector");
+        return false;
+    }
     bool result = true;
 
     for (i = 0; i < length; i ++) {
@@ -2170,7 +2175,10 @@ gjs_array_from_g_list (JSContext             *context,
     if (list_tag == GI_TYPE_TAG_GLIST) {
         for ( ; list != NULL; list = list->next) {
             arg.v_pointer = list->data;
-            elems.growBy(1);
+            if (!elems.growBy(1)) {
+                g_error("out of memory in gjs_array_from_g_list");
+                return false;
+            }
 
             if (!gjs_value_from_g_argument(context, elems[i], param_info, &arg,
                                            true))
@@ -2180,7 +2188,10 @@ gjs_array_from_g_list (JSContext             *context,
     } else {
         for ( ; slist != NULL; slist = slist->next) {
             arg.v_pointer = slist->data;
-            elems.growBy(1);
+            if (!elems.growBy(1)) {
+                g_error("out of memory in gjs_array_from_g_list");
+                return false;
+            }
 
             if (!gjs_value_from_g_argument(context, elems[i], param_info, &arg,
                                            true))
@@ -2234,7 +2245,10 @@ gjs_array_from_carray_internal (JSContext             *context,
         return gjs_string_from_ucs4(context, (gunichar *) array, length, value_p);
 
     JS::AutoValueVector elems(context);
-    elems.resize(length);
+    if (!elems.resize(length)) {
+        g_error("unable to resize vector");
+        return false;
+    }
 
 #define ITERATE(type) \
     for (i = 0; i < length; i++) { \
@@ -2454,7 +2468,10 @@ gjs_array_from_zero_terminated_c_array (JSContext             *context,
         g##type *array = (g##type *) c_array; \
         for (i = 0; array[i]; i++) { \
             arg.v_##type = array[i]; \
-            elems.growBy(1);                                            \
+            if (!elems.growBy(1)) { \
+                g_##error("elems.growBy(), out of memory in gjs_array_from_g_list"); \
+                return false; \
+            } \
             if (!gjs_value_from_g_argument(context, elems[i],           \
                                            param_info, &arg, true))     \
                 return false; \
diff --git a/gi/function.cpp b/gi/function.cpp
index 6ac04a9d..c844fdd2 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -216,7 +216,9 @@ gjs_callback_closure(ffi_cif *cif,
 
     n_outargs = 0;
     JS::AutoValueVector jsargs(context);
-    jsargs.reserve(n_args);
+    if (!jsargs.reserve(n_args)) {
+        g_error("jsargs.reserve(n_args), unable to reserve space in gjs_callback_closure");
+    }
     JS::RootedValue rval(context);
     JS::RootedValue rooted_function(context, trampoline->js_function);
     JS::RootedObject this_object(context);
@@ -259,14 +261,18 @@ gjs_callback_closure(ffi_cif *cif,
                                                (GArgument *) args[array_length_pos], true))
                     goto out;
 
-                jsargs.growBy(1);
+                if (!jsargs.growBy(1)) {
+                    g_error("jsargs.growBy(1), out of memory in gjs_callback_closure");
+                }
                 if (!gjs_value_from_explicit_array(context, jsargs[n_jsargs++],
                                                    &type_info, (GArgument*) args[i], length.toInt32()))
                     goto out;
                 break;
             }
             case PARAM_NORMAL:
-                jsargs.growBy(1);
+                if (!jsargs.growBy(1)) {
+                    g_error("jsargs.growBy(1), out of memory in gjs_callback_closure");
+                }
                 if (!gjs_value_from_g_argument(context, jsargs[n_jsargs++],
                                                &type_info,
                                                (GArgument *) args[i], false))
@@ -1044,7 +1050,9 @@ gjs_invoke_c_function(JSContext                             *context,
     /* Only process return values if the function didn't throw */
     if (function->js_out_argc > 0 && !did_throw_gerror) {
         for (size_t i = 0; i < function->js_out_argc; i++)
-            return_values.append(JS::UndefinedValue());
+            if (!return_values.append(JS::UndefinedValue())) {
+                g_error("invoke_c_function: unable to append to vector");
+            }
 
         if (return_tag != GI_TYPE_TAG_VOID) {
             GITransfer transfer = g_callable_info_get_caller_owns((GICallableInfo*) function->info);
diff --git a/gi/repo.cpp b/gi/repo.cpp
index e13cf82e..a06aeaaf 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -250,9 +250,8 @@ repo_new(JSContext *context)
 
     JS::RootedObject repo(context,
         JS_NewObjectWithGivenProto(context, &gjs_repo_class, proto));
-    if (repo == NULL) {
-        gjs_throw(context, "No memory to create repo object");
-        return NULL;
+    if (repo == nullptr) {
+        g_error("repo_new(), no memory to create repo object");
     }
 
     priv = g_slice_new0(Repo);
diff --git a/gi/value.cpp b/gi/value.cpp
index 65853754..4b50d85f 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -221,7 +221,9 @@ closure_marshal(GClosure        *closure,
     }
 
     JS::AutoValueVector argv(context);
-    argv.reserve(n_param_values);  /* May end up being less */
+    if (!argv.reserve(n_param_values)) {
+        g_error("argv.reserve(n_param_values), unable to reserve space in closure_marshal");
+    }
     JS::RootedValue argv_to_append(context);
     for (i = 0; i < n_param_values; ++i) {
         const GValue *gval = &param_values[i];
@@ -262,7 +264,9 @@ closure_marshal(GClosure        *closure,
             return;
         }
 
-        argv.append(argv_to_append);
+        if (!argv.append(argv_to_append)) {
+            g_error("argv.append(argv_to_append), out of memory in closure_marshal");
+        }
     }
 
     for (i = 1; i < n_param_values; i++)
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index 5b48b3b0..1a2ff6ea 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -394,7 +394,10 @@ load_module_elements(JSContext        *cx,
         return;
 
     for (ix = 0, length = ids.length(); ix < length; ix++)
-        prop_ids.append(ids[ix]);
+        if (!prop_ids.append(ids[ix])) {
+            g_error("prop_ids.append(), out of memory in load_module_elements");
+            return;
+        }
 }
 
 /* If error, returns false. If not found, returns true but does not touch
@@ -746,12 +749,16 @@ importer_enumerate(JSContext        *context,
                 continue;
 
             if (g_file_info_get_file_type(info) == G_FILE_TYPE_DIRECTORY) {
-                properties.append(gjs_intern_string_to_id(context, filename));
+                if (!properties.append(gjs_intern_string_to_id(context, filename))) {
+                    g_error("properties.append(), out of memory in importer_enumerate");
+                }
             } else if (g_str_has_suffix(filename, "." G_MODULE_SUFFIX) ||
                        g_str_has_suffix(filename, ".js")) {
                 GjsAutoChar filename_noext =
                     g_strndup(filename, strlen(filename) - 3);
-                properties.append(gjs_intern_string_to_id(context, filename_noext));
+                if (!properties.append(gjs_intern_string_to_id(context, filename_noext))) {
+                    g_error("properties.append(), out of memory in importer_enumerate");
+                }
             }
         }
     }
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 48f71f44..1fc48bd6 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -287,12 +287,16 @@ gjs_build_string_array(JSContext   *context,
         array_length = g_strv_length(array_values);
 
     JS::AutoValueVector elems(context);
-    elems.reserve(array_length);
+    if (!elems.reserve(array_length)) {
+        g_error("elems.reserve(), out of memory in gjs_build_string_array");
+    }
 
     for (i = 0; i < array_length; ++i) {
         JS::RootedValue element(context,
             JS::StringValue(JS_NewStringCopyZ(context, array_values[i])));
-        elems.append(element);
+        if (!elems.append(element)) {
+            g_error("elems.append(), out of memory in gjs_build_string_array");
+        }
     }
 
     return JS_NewArrayObject(context, elems);
@@ -839,7 +843,10 @@ gjs_eval_with_scope(JSContext             *context,
         return false;
 
     JS::AutoObjectVector scope_chain(context);
-    scope_chain.append(eval_obj);
+    if (!scope_chain.append(eval_obj)) {
+        g_error("gjs_eval_with_scope(), out of memory, unable to append to vector ");
+        return false;
+    }
     if (!JS_ExecuteScript(context, scope_chain, compiled_script, retval))
         return false;
 
diff --git a/gjs/module.cpp b/gjs/module.cpp
index 6b03c967..2a70415b 100644
--- a/gjs/module.cpp
+++ b/gjs/module.cpp
@@ -96,7 +96,9 @@ class GjsModule {
             return false;
 
         JS::AutoObjectVector scope_chain(cx);
-        scope_chain.append(module);
+        if (!scope_chain.append(module)) {
+            g_error("scope_chain.append(), out of memory in GjsModule::evaluate_import");
+        }
         JS::RootedValue ignored_retval(cx);
         if (!JS_ExecuteScript(cx, scope_chain, compiled_script, &ignored_retval))
             return false;
