sdtf08 发表于 2017-3-21 09:13:14

PHP memory_limit 问题解决

       memory_limit虽然可以调节内存大小,但是如果一个php脚本里有比较大的DB结果集或者数组、对象等,或者有众多的结果集,如果这些占用资源的对象得不到及时释放,可能在脚本后面一截执行过程中出现Allowed memory size of  xxx bytes exhausted at xxx:xxx (tried to allocate xxx bytes)的问题,所以这种情况下还是要及时的进行内存释放unset($xx),特别是一些CLI的PHP程序。
  PHP vesion >=V5.2
  memory_get_usage():http://php.chinaunix.net/manual/en/function.memory-get-usage.php
  memory_get_peak_usage():http://php.chinaunix.net/manual/en/function.memory-get-peak-usage.php
页: [1]
查看完整版本: PHP memory_limit 问题解决