如何调试“致命错误:内存不足(已分配XXX)(试图分配XXXXX字节)”? [英] How to Debug "Fatal error: Out of memory (allocated XXX) (tried to allocate XXXXX bytes)"?

查看:202
本文介绍了如何调试“致命错误:内存不足(已分配XXX)(试图分配XXXXX字节)”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看StackOverflow我意识到内存不足错误是一个常见的问题。 如其他人所建议的,在某些情况下可以通过增加php.ini中的内存限制进行管理。但是,通常这并不能解决错误,因为编码中存在问题。 >

这个错误最常见的来源是什么?你如何设计代码来避免它?



到目前为止,我知道来源:




  • 不定期循环

  • 将大量的db数据读取到变量中(可能有助于在使用它们之后取消设置var,如果它们不止一个? )


解决方案

是的,当然。



您必须获取/xxxxx/xxxxx.xxx脚本,并排除与第22行执行的操作相关的内容。

并使它消耗更少的内存。


Looking through StackOverflow I realized out-of-memory-errors are a common problem. As suggested by others it can under some circumstances be managed by increasing the memory limit in the php.ini.But often this doesn't solve the error as there is a problem within the coding.

What are most common sources of this error? How do you design your code to avoid it? How do you approach debugging such an error?

So far I know as sources:

  • indefinite loops
  • fetching large amount of db-data into a variable (possibly it helps to unset vars after using them, if it's more than one?)

解决方案

Yes, of course.

You have to get your /xxxxx/xxxxx.xxx script and sort things out related to the operation performed on the line 22.
And make it less memory consuming.

这篇关于如何调试“致命错误:内存不足(已分配XXX)(试图分配XXXXX字节)”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆