Last active
August 30, 2018 11:39
-
-
Save KennFatt/7d61b0c2f01d75f3f6efbd8e1c50d2a6 to your computer and use it in GitHub Desktop.
Testing PHP's Zend Memory Manager
This file contains 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 | |
/** | |
* Testing Zend Memory Manager. | |
* | |
* Testing allocated segments in Kilobytes | |
*/ | |
$m = (float) (memory_get_usage(true) / 1024); | |
echo "[0] Memory usage: " . $m . " Kb" . PHP_EOL; | |
$mem = range(1, 1024 * 1024); | |
$m = (float) (memory_get_usage(true) / 1024); | |
echo "[1] Memory usage: " . $m . " Kb" . PHP_EOL; | |
unset($mem); | |
$m = (float) (memory_get_usage(true) / 1024); | |
echo "[2] Memory usage: " . $m . " Kb" . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: