Skip to content

Instantly share code, notes, and snippets.

@trungx
Created March 3, 2021 03:44
Show Gist options
  • Save trungx/6508d6f61388daebe802d69f39d5d48d to your computer and use it in GitHub Desktop.
Save trungx/6508d6f61388daebe802d69f39d5d48d to your computer and use it in GitHub Desktop.
Check memory php use on server
<?php
function print_mem() {
$mem_usage = memory_get_usage();
$mem_peak = memory_get_peak_usage();
echo 'The script is now using: <strong>' . round($mem_usage / 1024) .' KB<strong> of memory.<br>';
echo 'Peak usage: <strong>' . round($mem_peak / 1024) .' KB<strong> of memory.<br>';
}
print_mem();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment