codeigniter-mcurl
codeigniter-mcurl copied to clipboard
curl_close($this->calls[$key]['curl'])
Multi-curl eats memory in a loop, so may be add curl_close($this->calls[$key]['curl']) inside execute() method for every particular curl handler?
May be curl_multi_remove_handle() and curl_multi_close() are not enough to clean used memory?
Are you sure it's the curl objects causing the memory problems? Or could it be that you are loading too much data at once?
I'm not able to get to this right now, but after line 148 here in this file: https://github.com/chadhutchins/codeigniter-mcurl/blob/master/application/libraries/mcurl.php#L148
Try adding the following: curl_close($this->calls[$key]["curl"]);
Does that solve the issue?
Actually that solves the problem. This manual says that individual curl_close() better to write after curl_multi_close() http://se2.php.net/manual/en/function.curl-multi-remove-handle.php
So after curl_multi_close($this->curl_parent); I've wrote again: foreach ($this->calls as $key => $call) curl_close($this->calls[$key]['curl']);
And now memory leaks problem almost solved. At least memory grows not so fast. And may be place curl_close() after 148 line could work too, I just didn't test it.
Would you mind testing it out some and supplying the pull request so you can be attributed the fix?