The following code is in a loop. Each loop changes $URI to a new address. My problem is that each pass takes up more and more memory.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $URI);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$res = curl_exec($ch);
curl_close($ch);
I finally worked out that if I comment out the CURLOPT_RETURNTRANSFER line the leak stops.
I use "CURLOPT_RETURNTRANSFER, true" so I can get the result of the cURL operation as a string to parse. But, it would appear that the memory used to store this string is not parsed with each pass. Can anyone suggest a way to clear this buffer and recover the used memory? Is there a destructor I could use, I've tried __destruct() but can't seem to get the syntax right.
Thanks C