|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-12-27 18:42 UTC] pierrick@php.net
[2012-12-27 18:42 UTC] pierrick@php.net
-Status: Open
+Status: Closed
[2013-01-12 16:39 UTC] derick@php.net
[2014-01-13 20:29 UTC] artur77 at freemail dot hu
[2014-10-07 23:20 UTC] stas@php.net
[2014-10-07 23:31 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 08:00:01 2025 UTC |
Description: ------------ PHP (or libcurl, I'm afraid I don't know where exactly the problem lies) seems to leak memory when using the same curl-handle for multiple requests. The test script below reports the same memory_get_usage()-value for the first 300 requests and a 25% increase after but top(1) reports the memory grows up to 100MB when the script is done. Uncommenting the resetting of CURLOPT_POSTFIELDS doesn't seem to help. Uncommenting the recreation of $ch prevents the memory from being leaked. Test script: --------------- <?php $ch = curl_init('http://some-domain.com/dump.html'); for($i = 0; 1000 > $i; $i++) { # $ch = curl_init('http://some-domain.com/dump.html'); $post = array(); $post['data'] = base64_encode(str_repeat(hash('sha256', uniqid()), 1000)); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec($ch); # curl_setopt($ch, CURLOPT_POSTFIELDS, ''); if($i % 100 == 0) { var_dump(memory_get_usage(true)); } } ?>