why this query is increase my Memory after Each loop? how can i Free that result?
public function getUser($startId, $endId){
$query = User::where('action','register')
->whereBetween('id', [$startId, $endId])
->whereNotNull('user_id')
->with(array('user.jPayUser' => function($query){
$query->select('id','gender','generation');
}));
return $query->get(array('users.*'));
}
User table have about 20k Record.
$chunk = 1000;
for($i = 1; $i <= $count; $i += $chunk)
{
$userLists = $this->getUser($i, $i + $chunk);
echo memory_get_usage();//It increase
}
I was research and put DB::disableQueryLogs()
but still eat memory
via user3809000