From: Erik Bernhardson Date: Wed, 2 Apr 2014 20:22:33 +0000 (-0700) Subject: Better memory reporting when running in HHVM X-Git-Tag: 1.31.0-rc.0~16390 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=49abc169d7446a7e5cbf63ba2148409c13357703;p=lhc%2Fweb%2Fwiklou.git Better memory reporting when running in HHVM Change-Id: If06b7b3ff4dc7ba8b873361f7878f8abb718f571 --- 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(), );