Introducing an example of displaying and releasing memory in PHP. It is very simple. It mainly focuses on the usage of the memory_get_usage() function.
Code: <?php //显示与释放内存 //以下数字取决于linux系统类型与版本 echo memory_get_usage() . "\n"; // 36640 $a = str_repeat("Hello", 4242); echo memory_get_usage() . "\n"; // 57960 unset($a); echo memory_get_usage() . "\n"; // 36744 ?> Copy after login |