-
-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
你好,这个常驻内存有内存泄漏问题啊 #53
Comments
自己在合适的位置,释放一下就行了 |
cli下自己释放了自己业务产生的变量,但循环执行一些任务的时候,依然会存在内存一直飙升的问题,看了下源码,没发现是哪儿的问题 |
|
for($i=188;$i<1800;$i++){ 如上:我注释掉所有业务相关代码; |
public function test1()
{
$gUrl = 'http://www.badmintoncn.com/';
for($i=188;$i<1800;$i++){
$tmpp = ($i-1)*100;
$str = "$tmpp,100";
// $res = $db -> query([""],"",$str,"");
$res = [
'id'=>1,
'url'=>''
];
for($i=0;$i<100;$i++){
$data = [];
$tmp = QueryList::get($gUrl)->encoding('UTF-8','GB2312');
$data['location'] = $tmp->find("#Label18")->text();
$data['num'] = $tmp ->find("#Label16")->text();
$data['date'] = $tmp ->find("#Label24")->text();
$data['price'] = $tmp ->find("#Label23")->text();
$data['company_b'] = $tmp ->find("#Label19")->text();
$data['company_a'] = $tmp ->find("#Label21")->text();
$data['type'] = $tmp ->find("#Label17")->text();
$data['area'] = $tmp ->find("#Label22")->text();
$tmp = null;
$data = null;
}
$size = memory_get_usage();
echo $this->convert($size).PHP_EOL;
sleep(1);
$tmpp = null;
$str = null;
$res = null;
echo 'page: '.$i."\r\n";
}
}
public function convert($size)
{
$unit=array('b','kb','mb','gb','tb','pb');
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
}
|
把这个问题解决了,搭配其他的任务投递方案,无人值守会更舒服,看好你这个框架哦,加油。持续跟进这个问题。 |
释放:$query->destruct(); |
使用完QueryList对象后要及时调用 |
全部是动态代理闭包未释放内存。 |
已优化内存占用 |
No description provided.
The text was updated successfully, but these errors were encountered: