ci做的登录报错:Allowed memory size
Fatal error:Allowed memory size of 67108864 bytes exhausted (tried to allocate 81 bytes) in /home/eloulist/public_html/investee.biz/system/database/drivers/mysql/mysql_result.php on line 147
请问这个是什么原因?
function _fetch_assoc()
{
return mysql_fetch_assoc($this->result_id);//147行
}
登录的这部分代码
$result = $this->UserModel->searchUser1 ( $pwuser, md5 ( $pwpwd ) );
if ($result != false) {
if (isset ( $result->status ) && $result->status != 0) {
$arr = array ('uid' => $result->uid, 'username' => $result->username, 'icon' => $result->icon, 'email' => $result->email, 'remember' => $remember );
$this->session->set_userdata ( 'islogin', $arr );
$data ['user'] = $pwuser;
$data ['pwd'] = $pwpwd;
if ($remember == 1) {
setcookie ( "uid", $result->uid, time () + 5184000 );
setcookie ( "name", $result->username, time () + 5184000 );
setcookie ( "pwd", $pwpwd, time () + 5184000 );
} else {
// setcookie ( "uid", $result->uid, time () );
// setcookie ( "name", $result->username, time () );
}
if($backurl!=null){
redirect ( 'http://'.$backurl );
}else{
redirect ( 'welcome/index' );
}
} else {
$data ['error'] = $this->lang->line ( 'emailerror' );
// print_r($data ['error']);
$this->load->view ( 'login', $data );
}
这个是在登录的时候出现的问题,这个项目已经运行大半年了,今天登录的时候突然报这个错误,我虽然知道修改memory_limit可以解决,但这也不是根本办法,所以请各位看看是什么原因导致ci这个地方出错了?
nginx?还是apache? spt119 发表于 2011-8-31 10:07 static/image/common/back.gif
nginx?还是apache?
应该是apache
我觉得也许是因为登录某个代码问题,导致用户登录后的内存一直在增加没有释放掉最后导致现在这个问题的出现了. zhouli520 发表于 2011-8-31 10:59 static/image/common/back.gif
应该是apache
我觉得也许是因为登录某个代码问题,导致用户登录后的内存一直在增加没有释放掉最后导致现在 ...
PHP的GC机制不是会这个线程关闭了就回收吗??不过我没深入研究PHP的GC
我就知道有句话:"无论PHP的代码多烂,总不会出现内存问题" 看一下PHP内存占用,是不是查询了太多的记录,CI 是把所有记录都查询出来,然后放到数组里。 Hex 发表于 2011-8-31 11:45 static/image/common/back.gif
看一下PHP内存占用,是不是查询了太多的记录,CI 是把所有记录都查询出来,然后放到数组里。 ...
memory usage: 64.57 MB
看了下登录后跳转到首页的内存占用......果然超过限制了
看了下首页index方法 ,查询的sql语句太多了,而且也没有做sql查询的限制,导致随着时间增加,查询出的数据越来越多,内存占用不断增加,刚重新优化了下model层里的查询后内存占用马上减少一半了 zhouli520 发表于 2011-8-31 13:09 static/image/common/back.gif
memory usage: 64.57 MB
看了下登录后跳转到首页的内存占用......果然超过限制了
看了下首页index方法 , ...
说说怎么处理的..新人想学习!
页:
[1]