diff options
author | Ondřej Surý <ondrej@sury.org> | 2013-10-27 20:38:12 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2013-10-27 20:38:12 +0100 |
commit | 749e5ad39dbac3f4f62be438367f8cdf90056815 (patch) | |
tree | ad0677df3bf44a6761380686e400ffd878585288 /ext/curl/tests/bug65458.phpt | |
parent | 4ed39205864f58ba7c368e4ae1362d8214469fd9 (diff) | |
download | php-749e5ad39dbac3f4f62be438367f8cdf90056815.tar.gz |
New upstream version 5.4.21upstream/5.4.21
Diffstat (limited to 'ext/curl/tests/bug65458.phpt')
-rw-r--r-- | ext/curl/tests/bug65458.phpt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/curl/tests/bug65458.phpt b/ext/curl/tests/bug65458.phpt new file mode 100644 index 000000000..99288f24b --- /dev/null +++ b/ext/curl/tests/bug65458.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #65458 (curl memory leak) +--SKIPIF-- +<?php +if (!extension_loaded('curl')) exit("skip curl extension not loaded"); +?> +--FILE-- +<?php +$ch = curl_init(); +$init = memory_get_usage(); +for ($i = 0; $i < 10000; $i++) { + curl_setopt($ch, CURLOPT_HTTPHEADER, [ "SOAPAction: getItems" ]); +} + +$preclose = memory_get_usage(); +curl_close($ch); + +// This is a slightly tricky heuristic, but basically, we want to ensure +// $preclose - $init has a delta in the order of bytes, not megabytes. Given +// the number of iterations in the loop, if we're wasting memory here, we +// should have megs and megs of extra allocations. +var_dump(($preclose - $init) < 10000); +?> +--EXPECT-- +bool(true) |