Bug #69998 [Opn->Fbk]: curl multi leaking memory

From: Date: Thu, 09 Jul 2015 11:08:14 +0000
Subject: Bug #69998 [Opn->Fbk]: curl multi leaking memory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194249@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69998&edit=1 ID: 69998 Updated by: kalle@php.net Reported by: fred_brownuk at yahoo dot co dot uk Summary: curl multi leaking memory -Status: Open +Status: Feedback Type: Bug Package: cURL related Operating System: Mint 17.1 & Debian 6 LTS PHP Version: 7.0.0alpha2 Block user comment: N Private report: N New Comment: Can you confirm this leak with a valgrind output or similar? valgrind --leak-check=yes php bug69998.php should be sufficient to confirm this Previous Comments: ------------------------------------------------------------------------ [2015-07-05 22:56:16] fred_brownuk at yahoo dot co dot uk Description: ------------ On both 7.0.0alpha1 and 7.0.0alpha2 the curl multi interface is holding onto resources. A curl handle added to a multi handle with curl_multi_add_handle() should be fully independent once released from the multi handle with curl_multi_remove_handle(). Curl handles are not being released properly. Repeated use of the multi interface is leaking memory. Test script: --------------- // curl multi holding onto curl handles $mh=curl_multi_init(); $ch = curl_init(); curl_multi_add_handle($mh, $ch); curl_multi_remove_handle($mh, $ch); var_dump($ch); curl_close($ch); var_dump($ch); curl_multi_close($mh); // show memory leak for ($l=0; $l<10; $l++) { $mh=curl_multi_init(); $ch = curl_init(); curl_multi_add_handle($mh, $ch); curl_multi_remove_handle($mh, $ch); curl_close($ch); curl_multi_close($mh); echo memory_get_usage().PHP_EOL; } Expected result: ---------------- resource(5) of type (curl) resource(5) of type (Unknown) 374192 374192 374192 374192 374192 374192 374192 374192 374192 374192 Actual result: -------------- resource(5) of type (curl) resource(5) of type (curl) 374192 374536 374560 374584 374608 375272 375296 375320 375344 375368 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69998&edit=1

« previous php.bugs (#194249) next »