From 49abc169d7446a7e5cbf63ba2148409c13357703 Mon Sep 17 00:00:00 2001 From: Erik Bernhardson Date: Wed, 2 Apr 2014 13:22:33 -0700 Subject: [PATCH] Better memory reporting when running in HHVM Change-Id: If06b7b3ff4dc7ba8b873361f7878f8abb718f571 --- includes/debug/Debug.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/debug/Debug.php b/includes/debug/Debug.php index 15ed3cbecd..86f3dda02f 100644 --- a/includes/debug/Debug.php +++ b/includes/debug/Debug.php @@ -530,6 +530,12 @@ class MWDebug { global $wgVersion, $wgRequestTime; $request = $context->getRequest(); + // HHVM's reported memory usage from memory_get_peak_usage() + // is not useful when passing false, but we continue passing + // false for consistency of historical data in zend. + // see: https://github.com/facebook/hhvm/issues/2257#issuecomment-39362246 + $realMemoryUsage = wfIsHHVM(); + return array( 'mwVersion' => $wgVersion, 'phpVersion' => PHP_VERSION, @@ -546,8 +552,8 @@ class MWDebug { 'headers' => $request->getAllHeaders(), 'params' => $request->getValues(), ), - 'memory' => $context->getLanguage()->formatSize( memory_get_usage() ), - 'memoryPeak' => $context->getLanguage()->formatSize( memory_get_peak_usage() ), + 'memory' => $context->getLanguage()->formatSize( memory_get_usage( $realMemoryUsage ) ), + 'memoryPeak' => $context->getLanguage()->formatSize( memory_get_peak_usage( $realMemoryUsage ) ), 'includes' => self::getFilesIncluded( $context ), 'profile' => Profiler::instance()->getRawData(), ); -- 2.20.1