You are here

function _xmlsitemap_get_memory_usage in XML sitemap 6.2

Same name and namespace in other branches
  1. 7.2 xmlsitemap.generate.inc \_xmlsitemap_get_memory_usage()

File

./xmlsitemap.generate.inc, line 82
Sitemap generation and rebuilding functions for the xmlsitemap module.

Code

function _xmlsitemap_get_memory_usage($start = FALSE) {
  static $memory_start;
  $current = 0;
  if (function_exists('memory_get_peak_usage')) {
    $current = memory_get_peak_usage(TRUE);
  }
  if (function_exists('memory_get_usage')) {
    $current = version_compare(PHP_VERSION, '5.2') ? memory_get_usage(TRUE) : memory_get_usage();
  }
  if (!isset($memory_start) || $start) {
    $memory_start = $current;
  }
  return $current - $memory_start;
}