Understanding php “Out of memory” error

夙愿已清 提交于 2019-12-17 16:33:11

问题


I can find lots of tutorials on how to overcome the out-of-memory error. The solution is: To increase the memory in the php.ini or in the .htaccess - what a surprise...

I actually don't understand the error message:

Fatal error: Out of memory (allocated 32016932) (tried to allocate 25152 bytes)

"Allocated 32016932", means 32MB have been allocated as in - the PHP script is using 32MB? Tried to allocate 25152, means that another 25KB were tried to be allocated, but the script failed as the maximum (of ~ 32MB?) has been reached?

What can I actually tell from this error message, besides that I'm "out of memory"?


回答1:


I Always interpreted it like:

Fatal error: Out of memory ([currently] allocated 32016932) (tried to allocate [additional] 25152 bytes)

But good Question if there is a bulletproof explanation.




回答2:


It's exactly like you understood it.

The limit is probably set at 32MB, you have already 32016932 bytes allocated and when php tried to allocate 25152 more bytes, the limit is exceeded thus the error message.

You probably can see the line where the faulty allocation happened in your logs or near the error message on your screen.

Good luck finding the culprit.



来源:https://stackoverflow.com/questions/5118927/understanding-php-out-of-memory-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!