Note that changing it to pass an array of post args instead of passing it a string makes the leak go away.

This block of code in interface.c deals with the string case:

            } else {
                char *post = NULL;

                convert_to_string_ex(zvalue);
                post = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
                zend_llist_add_element(&ch->to_free.str, &post);

                error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_PP(zvalue));
            }

convert it to a string, estrndup it with the right args and add it to the to_free.str list. Then in the destructor for the resource we have:

   zend_llist_clean(&ch->to_free.str);

So I am obviously missing something.  That code looks fine.

-Rasmus

Daniel Brown wrote:
On Sat, May 17, 2008 at 3:04 AM, Rasmus Lerdorf <[EMAIL PROTECTED]> wrote:
start 326616
GET 327256
GET 327276
GET 327276
GET 327276
GET 327276
GET 327276
GET 327276
GET 327276
GET 327276
GET 327276
POST 327516
POST 327588
POST 327652
POST 327712
POST 327892
POST 328064
POST 328228
POST 328384
POST 328528
POST 328628

    It's not a solution, Rasmus, but here's more data, taken from
5.2.4.  The results were exactly the same, in the same order, after
running your code ten times.

start 57140
GET 57820
GET 57820
GET 57820
GET 57820
GET 57820
GET 57820
GET 57820
GET 57820
GET 57820
GET 57820
POST 58244
POST 58492
POST 58728
POST 58948
POST 59060
POST 59164
POST 59264
POST 59360
POST 59452
POST 59452

    When changing the for() loop in the curl() function to this:

<?php
for($args='',$i=0;$i<75;$i++) {
  $args .= $i == 0 ? "a=$i" : "&a=$i";
}
?>

    The results stabilize quicker:

start 57688
GET 58340
GET 58340
GET 58340
GET 58340
GET 58340
GET 58340
GET 58340
GET 58340
GET 58340
GET 58340
POST 58844
POST 59088
POST 59416
POST 59692
POST 59800
POST 59904
POST 59904
POST 59904
POST 59904
POST 59904



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to