diff --git a/includes/update.inc b/includes/update.inc
index 4878e7db64f71eb77eb0e077674f1cf175b91b45..4398643114b7bc2fa0f7ae920c890d2449d0a1ab 100644
--- a/includes/update.inc
+++ b/includes/update.inc
@@ -410,6 +410,8 @@ function update_do_one($module, $number, &$context) {
   // Record the schema update if it was completed successfully.
   if ($context['finished'] == 1 && empty($context['results'][$module]['#abort'])) {
     drupal_set_installed_schema_version($module, $number);
+    // Conserve memory and avoid errors by resetting all static variables.
+    drupal_static_reset();
   }
 
   $context['message'] = 'Updating ' . check_plain($module) . ' module';