开发者社区> 问答> 正文

"Allowed memory size of 536870912 bytes exhausted "问题

Allowed memory size of 536870912 bytes exhausted (tried to allocate 130968 bytes)
什么原因导致的,求大神解惑。

public function test()
{
$start = '1444320000';
$end = '1444406399';
$shop_pv_opt = $this->get_shop_pv($start, $end);
$status = $this->deal_analysis($shop_pv_opt);
}
private function deal_analysis($opt)
{
$statelog_list = $this->mongodb_stat_log_obj->aggregate($opt);
}


private function get_shop_pv($start, $end)
{

$opt = array(
array(
'$match'=>array(
'time'=>array(
'$gte'=>$start,
'$lte'=>$end))),
array(
'$group'=>array(
'_id'=>array(
'merchant_id'=>'$merchant_id',
'pro_id'=>'$pro_id'),
'pv'=>array(
'$sum'=>1))),
array(
'$sort'=>array(
'_id'=>1)));
return $opt;
}
public function aggregate($opt)
{
  $this->selectCollection('stat_log');
  $result = $this->aggregate($opt);//执行aggregate时mongo里只有十几条数据,但是报内存超限错误
  return $result;
}

展开
收起
落地花开啦 2016-02-25 17:17:20 3470 0
1 条回答
写回答
取消 提交回答
  • 喜欢技术,喜欢努力的人
    1. 内存消耗多大,之前遇到过下载文件,每次都读到内存,文件过大报错
    2. 死循环了,如果不知道在哪里的话,就用最丑的办法,一步一步exit('fuck')
    2019-07-17 18:47:42
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
KR^X- Comprehensive- Kernel-Protection-Against-Just-In-Time-Code-Reuse 立即下载
AVPASS:Automatically Bypassing 立即下载
Large Scale Data Files,Object 立即下载