/**
  * Checks peak memory usage and stores data in cache for use in the report module
  *
  * @return void
  */
 public static function peakMemoryUsage()
 {
     $peakUsage = memory_get_peak_usage(true);
     $memoryLimit = GeneralUtility::getBytesFromSizeMeasurement(ini_get('memory_limit'));
     if (is_double($memoryLimit) && $memoryLimit != 0) {
         if ($peakUsage / $memoryLimit >= 0.9) {
             /** @var $registry \TYPO3\CMS\Core\Registry */
             $registry = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Registry::class);
             $data = array('used' => $peakUsage, 'tstamp' => $GLOBALS['EXEC_TIME'], 'url' => GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'));
             $registry->set('core', 'reports-peakMemoryUsage', $data);
         }
     }
 }