diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index f8d6ae8..8a94f65 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -184,9 +184,18 @@ function simpletest_run_phpunit_tests($test_id, array $unescaped_test_classnames
   $phpunit_file = simpletest_phpunit_xml_filepath($test_id);
   simpletest_phpunit_run_command($unescaped_test_classnames, $phpunit_file, $status, $output);
 
+  $mem = '0';
+  if (is_array($output) && count($output)) {
+    $mem = array_filter($output, function($v) { return stripos($v, 'Memory: '); });
+    $mem = !empty($mem) ? explode('Memory: ', array_pop($mem)) : '';
+    $mem = !empty($mem) && is_array($mem) ? array_pop($mem) : '0';
+    $mem = trim(str_ireplace('MB', '', $mem));
+    $mem = (int)(floatval($mem)*1048576);
+  }
+
   $rows = [];
   if ($status == TestStatus::PASS) {
-    $rows = simpletest_phpunit_xml_to_rows($test_id, $phpunit_file);
+    $rows = simpletest_phpunit_xml_to_rows($test_id, $phpunit_file, $mem);
   }
   else {
     $rows[] = [
@@ -240,7 +249,7 @@ function simpletest_summarize_phpunit_result($results) {
         '#pass' => 0,
         '#fail' => 0,
         '#exception' => 0,
-        '#debug' => 0,
+        '#debug' => $result['message'],
       );
     }
 
@@ -258,7 +267,7 @@ function simpletest_summarize_phpunit_result($results) {
         break;
 
       case 'debug':
-        $summaries[$result['test_class']]['#debug']++;
+        //$summaries[$result['test_class']]['#debug']++;
         break;
     }
   }
@@ -766,7 +775,7 @@ function simpletest_mail_alter(&$message) {
  *   The results as array of rows in a format that can be inserted into
  *   {simpletest}.
  */
-function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) {
+function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file, $mem = '0') {
   $contents = @file_get_contents($phpunit_xml_file);
   if (!$contents) {
     return;
@@ -774,7 +783,7 @@ function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) {
   $records = array();
   $testcases = simpletest_phpunit_find_testcases(new SimpleXMLElement($contents));
   foreach ($testcases as $testcase) {
-    $records[] = simpletest_phpunit_testcase_to_row($test_id, $testcase);
+    $records[] = simpletest_phpunit_testcase_to_row($test_id, $testcase, $mem);
   }
   return $records;
 }
@@ -830,8 +839,8 @@ function simpletest_phpunit_find_testcases(\SimpleXMLElement $element, \SimpleXM
  * @return array
  *   An array containing the {simpletest} result row.
  */
-function simpletest_phpunit_testcase_to_row($test_id, \SimpleXMLElement $testcase) {
-  $message = '';
+function simpletest_phpunit_testcase_to_row($test_id, \SimpleXMLElement $testcase, $mem = '0') {
+  $message = $mem;
   $pass = TRUE;
   if ($testcase->failure) {
     $lines = explode("\n", $testcase->failure);
diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh
index 2936723..64972f5 100755
--- a/core/scripts/run-tests.sh
+++ b/core/scripts/run-tests.sh
@@ -618,6 +618,9 @@ function simpletest_script_execute_batch($test_classes) {
   $total_status = SIMPLETEST_SCRIPT_EXIT_SUCCESS;
 
   // Multi-process execution.
+  $directory = PublicStream::basePath() . '/simpletest';
+  file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
+  $logfile = $directory . '/mem-child-proc.log';
   $children = array();
   while (!empty($test_classes) || !empty($children)) {
     while (count($children) < $args['concurrency']) {
@@ -647,6 +650,13 @@ function simpletest_script_execute_batch($test_classes) {
         exit(SIMPLETEST_SCRIPT_EXIT_SUCCESS);
       }
 
+      $apcuinfo = ';;';
+      if (function_exists('apcu_sma_info')) {
+        $info = apcu_sma_info(TRUE);
+        $apcuinfo = $info['avail_mem'].';'.$info['seg_size'].';'.$info['num_seg'];
+      }
+      file_put_contents($logfile, date('YmdHis') . ';+;' . $test_id . ';' . $test_class . ';' . $apcuinfo . PHP_EOL, FILE_APPEND | LOCK_EX);
+
       // Register our new child.
       $children[] = array(
         'process' => $process,
@@ -697,6 +707,13 @@ function simpletest_script_execute_batch($test_classes) {
           simpletest_script_cleanup($child['test_id'], $child['class'], $status['exitcode']);
         }
 
+        $apcuinfo = ';;';
+        if (function_exists('apcu_sma_info')) {
+          $info = apcu_sma_info(TRUE);
+          $apcuinfo = $info['avail_mem'].';'.$info['seg_size'].';'.$info['num_seg'];
+        }
+        file_put_contents($logfile, date('YmdHis') . ';-;' . $child['test_id'] . ';' . $child['class'] . ';' . $apcuinfo . PHP_EOL, FILE_APPEND | LOCK_EX);
+
         // Remove this child.
         unset($children[$cid]);
       }
@@ -750,6 +767,7 @@ function simpletest_script_run_one_test($test_id, $test_class) {
       $test->dieOnFail = (bool) $args['die-on-fail'];
       $test->verbose = (bool) $args['verbose'];
       $test->run($methods);
+      $test->results['#debug'] = memory_get_peak_usage(TRUE);
       simpletest_script_reporter_display_summary($test_class, $test->results);
 
       $status = SIMPLETEST_SCRIPT_EXIT_SUCCESS;
@@ -1130,7 +1148,7 @@ function simpletest_script_reporter_display_summary($class, $results) {
   // Output all test results vertically aligned.
   // Cut off the class name after 60 chars, and pad each group with 3 digits
   // by default (more than 999 assertions are rare).
-  $output = vsprintf('%-60.60s %10s %9s %14s %12s', array(
+  $output = vsprintf('%-80.80s %10s %9s %14s %12s', array(
     $class,
     $results['#pass'] . ' passes',
     !$results['#fail'] ? '' : $results['#fail'] . ' fails',
diff --git a/update.php b/update.php
index 42adef2..7d726b1 100644
--- a/update.php
+++ b/update.php
@@ -20,3 +20,6 @@
 $response->send();
 
 $kernel->terminate($request, $response);
+
+$logfile = $kernel->getAppRoot() . '/sites/default/files/simpletest/mem-update.log';
+file_put_contents($logfile, date('YmdHis') . ';U;' . memory_get_peak_usage(TRUE) . PHP_EOL, FILE_APPEND | LOCK_EX);
