Rasmus Lerdorf escribió:
Can someone spot why this code

(tested in both 5.2.5 and 5.3)

<?php
function curl($post) {
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, "www.fdhfkdsslak.bogus");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  if($post) {
    curl_setopt($ch, CURLOPT_POST, 1);
    for($args='',$i=0;$i<75;$i++) $args .= "a=$i&";
    curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
    unset($args);
  }
  curl_exec($ch);
  curl_close($ch);
}
echo "start ".memory_get_usage()."\n";
for($i=0;$i<10;$i++) {
  curl(0);
  echo "GET ".memory_get_usage()."\n";
}
for($i=0;$i<10;$i++) {
  curl(1);
  echo "POST ".memory_get_usage()."\n";
}
?>

outputs:

for me

start 120400
GET 122624
GET 122624
GET 122624
GET 122624
GET 122624
GET 122624
GET 122624
GET 122624
GET 122624
GET 122624
POST 124968
POST 125928
POST 126608
POST 127272
POST 127920
POST 128552
POST 129168
POST 129768
POST 130352
POST 130920

when I request for  $real_usage the results are constant..

--
"Progress is possible only if we train ourselves to think about programs
without thinking of them as pieces of executable code.” - Edsger W. Dijkstra

Cristian Rodríguez R.
Platform/OpenSUSE - Core Services
SUSE LINUX Products GmbH
Research & Development
http://www.opensuse.org/


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to