note 117662 deleted from function.curl-multi-close by cmb
| From: | cmb@php.net | Date: | Fri, 17 Jul 2015 12:27:45 +0000 |
| Subject: | note 117662 deleted from function.curl-multi-close by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203125@lists.php.net to get a copy of this message | ||
Note Submitter: Joey
----
I second jonhohle.
I recently fixed a memory leak and found that curl_multi_add_handle behaves as though adding the
multi handler (mh) to the curl handler (ch) rather than vice versa.
This means that closing the mh wont free the mh unless it has been removed from all chs.
curl_multi_close will not cascade.
However, because the mh is added to the ch, you can close the ch without removing the mh. curl_close
will cascade.
I have no memory leak when using curl_close without curl_multi_remove_handle.
I think it would be good advice to add that as a rule of thumb all handlers should be remove or
closed when done with individually to avoid memory leaks and complexity. An extra remove mh with a
close ch wont do any harm.