正在发生的事情是,在随机的时间,网页会引发“允许的内存耗尽”#34; apache日志中的错误。我有两个时间的xdebug跟踪,当问题发生时和正常运行时。当我比较跟踪文件时,令人惊讶的是看到日志条目没有任何函数名称和它们消耗的随机内存量。所以,我想要理解两件事。
我有以下代码
if (function_exists('ini_set')) {
ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
}
如果出现错误,其跟踪日志为
2 23 0 0.007218 701448 function_exists 0 app/webroot/index.php 101 1 'ini_set'
2 23 1 0.007236 701448
2 24 0 0.007255 701592 ini_get 0 app/webroot/index.php 102 1 'include_path'
2 24 1 0.007277 701648
2 25 0 0.007288 701592 ini_set 0 app/webroot/index.php 102
2 'include_path' 'httpdocs/lib:.:/usr/share/pear:/usr/share/php'
2 25 1 0.007617 702016
2 26 0 0.008726 755816 include 1 lib/Cake/bootstrap.php app/webroot/index.php 104 0
此日志有两个功能ID 25的条目,即ini_set(),内存为701592和702016.第一个条目消耗的内存为702016-701592 = 424字节,第二个条目消耗的内存为755816-702016 = 53800字节。
我无法理解没有任何函数Name的第二个条目的存在以及第二个条目的内存到底在哪里被使用?
以下是另一次运行的日志。这里同样是功能Id 25的两个条目,存储器为645616和646040.第一个条目消耗的内存是646040-645616 = 424个字节(与之前相同),第二个条目消耗的内存是646176-646040 = 136个字节(最后一个)运行它是53800字节)。
同样,它在哪里被使用,为什么这个数量会有所不同!我可以在这两个跟踪日志中看到许多这样的偏差,总结到一定程度导致“允许内存耗尽”#34;错误。请帮我理解这一点。
2 23 0 0.000908 645472 function_exists 0 app/webroot/index.php 101 1 'ini_set'
2 23 1 0.000924 645472
2 24 0 0.000936 645616 ini_get 0 app/webroot/index.php 102 1 'include_path'
2 24 1 0.000952 645672
2 25 0 0.000960 645616 ini_set 0 app/webroot/index.php 102 2 'include_path' 'lib:.:/usr/share/pear:/usr/share/php'
2 25 1 0.000996 646040
2 26 0 0.001034 646176 include 1 lib/Cake/bootstrap.php app/webroot/index.php 104 0