xref: /PHP-8.2/ext/curl/tests/bug65458.phpt (revision 39131219)
1--TEST--
2Bug #65458 (curl memory leak)
3--EXTENSIONS--
4curl
5--FILE--
6<?php
7$ch = curl_init();
8$init = memory_get_usage();
9for ($i = 0; $i < 10000; $i++) {
10    curl_setopt($ch, CURLOPT_HTTPHEADER, [ "SOAPAction: getItems" ]);
11}
12
13$preclose = memory_get_usage();
14curl_close($ch);
15
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.
20var_dump(($preclose - $init) < 10000);
21?>
22--EXPECT--
23bool(true)
24