Created
March 3, 2021 03:44
-
-
Save trungx/6508d6f61388daebe802d69f39d5d48d to your computer and use it in GitHub Desktop.
Check memory php use on server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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