1--TEST-- 2Bug #45161 (Reusing a curl handle leaks memory) 3--EXTENSIONS-- 4curl 5--SKIPIF-- 6<?php 7if (PHP_OS_FAMILY === 'Windows') die('skip This test is insanely slow on Windows'); 8?> 9--FILE-- 10<?php 11include 'server.inc'; 12$host = curl_cli_server_start(); 13 14// Fill memory for test 15$ch = curl_init(); 16$fp = fopen(PHP_OS_FAMILY === 'Windows' ? 'nul' : '/dev/null', 'w'); 17 18/* 19$i = $start = $end = 100000.00; 20for ($i = 0; $i < 100; $i++) { 21 curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/'); 22 curl_setopt($ch, CURLOPT_FILE, $fp); 23 curl_exec($ch); 24} 25*/ 26 27// Start actual test 28$start = memory_get_usage() + 1024; 29for($i = 0; $i < 1024; $i++) { 30 curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc"); 31 curl_setopt($ch, CURLOPT_FILE, $fp); 32 curl_exec($ch); 33} 34if ($start < memory_get_usage()) { 35 echo 'FAIL'; 36} else { 37 echo 'PASS'; 38} 39echo "\n"; 40fclose($fp); 41unset($fp); 42?> 43--EXPECT-- 44PASS 45