PHP curl, memory leak when using CURLOPT_SSL_VERIFYPEER, true

I have been using cloudfusion for quite some time and I need to switch to the new version of AWS sdk and run into memory leaks. A memory leak has been reported for about a year, with no real solution. After a lot of reading, performing tests and research results, the following simple daemon reproduces the problem

#! /usr/bin/env php
<?php class httpsTest{
    function curlHttps($memLeak=false){
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, 'https://sqs.us-east-1.amazonaws.com');
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $memLeak);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_exec($curl);
        curl_close($curl);
    }
}
gc_enable();
$myPid = getmypid();$i=0;
$test  = new httpsTest();
while ($test){
    $test->curlHttps(true);
    echo $i++ ." PHP Info MemUsage: ".memory_get_usage() ."    Linux Info ";
    system('cat /proc/' .$myPid .'/status|grep '.'"VmSize"');
    sleep(1);
}

Therefore, when using CURLOPT_SSL_VERIFYPEER with a value of true, it flows 132 kbytes every 18 iterations. To ensure that I am not beating a dead horse, the fedora 14 system was updated with php 5.3.10, libcurl 7.24.0.-1.0, nss-3.12.10-7, openssl-1.0.0e-1.

, , , php. , php, , php , .

, , . 16- , , . , , , .

+2

All Articles