bug65458.phpt 616 B

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