Annotation of embedaddon/php/ext/curl/tests/bug65458.phpt, revision 1.1
1.1 ! misho 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:
! 15: $preclose = memory_get_usage();
! 16: curl_close($ch);
! 17:
! 18: // This is a slightly tricky heuristic, but basically, we want to ensure
! 19: // $preclose - $init has a delta in the order of bytes, not megabytes. Given
! 20: // the number of iterations in the loop, if we're wasting memory here, we
! 21: // should have megs and megs of extra allocations.
! 22: var_dump(($preclose - $init) < 10000);
! 23: ?>
! 24: --EXPECT--
! 25: bool(true)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>