xref: /PHP-5.6/ext/curl/tests/bug65458.phpt (revision aa7d3d8e)
1--TEST--
2Bug #65458 (curl memory leak)
3--SKIPIF--
4<?php
5if (!extension_loaded('curl')) exit("skip curl extension not loaded");
6?>
7--FILE--
8<?php
9$ch = curl_init();
10$init = memory_get_usage();
11for ($i = 0; $i < 10000; $i++) {
12    curl_setopt($ch, CURLOPT_HTTPHEADER, [ "SOAPAction: getItems" ]);
13}
14
15$preclose = memory_get_usage();
16curl_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.
22var_dump(($preclose - $init) < 10000);
23?>
24--EXPECT--
25bool(true)
26