diff --git a/update.php b/update.php
index 42adef25d67d644b1ccae24c2e0d5af96a8519b3..59e808ed24c52caa9d451dec91e3a4fd944f2041 100644
--- a/update.php
+++ b/update.php
@@ -13,6 +13,15 @@
 
 $autoloader = require_once 'autoload.php';
 
+// Disable garbage collection during test runs. Under certain circumstances the
+// update path will create so many objects that garbage collection causes
+// segmentation faults.
+require_once 'core/includes/bootstrap.inc';
+if (drupal_valid_test_ua()) {
+  gc_collect_cycles();
+  gc_disable();
+}
+
 $kernel = new UpdateKernel('prod', $autoloader, FALSE);
 $request = Request::createFromGlobals();