bug65458.phpt 687 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. Bug #65458 (curl memory leak)
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('curl')) exit("skip curl extension not loaded");
  6. ?>
  7. --FILE--
  8. <?php
  9. $ch = curl_init();
  10. $init = memory_get_usage();
  11. for ($i = 0; $i < 10000; $i++) {
  12. curl_setopt($ch, CURLOPT_HTTPHEADER, [ "SOAPAction: getItems" ]);
  13. }
  14. $preclose = memory_get_usage();
  15. curl_close($ch);
  16. // This is a slightly tricky heuristic, but basically, we want to ensure
  17. // $preclose - $init has a delta in the order of bytes, not megabytes. Given
  18. // the number of iterations in the loop, if we're wasting memory here, we
  19. // should have megs and megs of extra allocations.
  20. var_dump(($preclose - $init) < 10000);
  21. ?>
  22. --EXPECT--
  23. bool(true)