Skip to content

Instantly share code, notes, and snippets.

@svendecabooter
Created January 18, 2013 15:13
Show Gist options
  • Save svendecabooter/4565210 to your computer and use it in GitHub Desktop.
Save svendecabooter/4565210 to your computer and use it in GitHub Desktop.
memory usage debug
function cur_memory() {
$unit=array('b','kb','mb','gb','tb','pb');
$size=memory_get_usage(TRUE);
$memory = @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
return $memory;
}
print cur_memory();
//some_potentially_intensive_function();
print cur_memory();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment