|
本帖最后由 liaow10 于 2018-8-6 17:59 编辑
项目偶尔会出现这种报错:
Severity:Error --> Allowed memory size of 134217728 bytes exhausted (tried to allocate 140015415477232 bytes) Unknown 0
Traceback: Extra: ["[GET]\/module-switch","params:"]
Severity:Error --> Allowed memory size of 134217728 bytes exhausted (tried to allocate 140548902478832 bytes) Unknown 0
Traceback: Extra: ["[POST]\/user-allfriends","params:"]
Severity:Error --> Allowed memory size of 134217728 bytes exhausted (tried to allocate 139702872970224 bytes) Unknown 0
Traceback: Extra: ["[GET]\/user-else-detail\/2256941804","params:"]
下面的那个 Extra 内容是我自己添加的,为了追查为什么会出现申请超大内存的问题,把请求协议和参数打了出来,结果还是没有发现什么蛛丝马迹,请问大佬们,这个是什么原因呢?
用的是 CI 3.1.0,拿第一个协议内容来举例子:
PHP复制代码
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once(APPPATH . 'controllers/BaseController.php');
class ModuleSwitch extends BaseController {
function __construct (){
parent ::__construct ();
}
private function get_switch_redis ()
{
require_once(APPPATH . 'libraries/RedisExtra.php');
return new RedisExtra ('xxx');
}
public function get_status ()
{
$redis = $this->get_switch_redis();
$values = $redis->hgetall('MODULE_SWITCH');
$status = array();
if ($values) {
foreach ($values as $key => $value) {
$status[$key] = (boolean )$value;
}
}
if (empty($status))
$status = (object )$status;
self::_makeResponse (RETURN_OK , $status);
}
}
复制代码
|
|