The following code is in a loop. Each loop changes $ URI to a new address. My problem is that each pass takes up 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 found out that if I comment on the line CURLOPT_RETURNTRANSFER, the leak will stop.
I use "CURLOPT_RETURNTRANSFER, true", so I can get the result of the cURL operation as a string for parsing. But it seems that the memory used to store this line is not processed by each pass. Can anyone suggest a way to clear this buffer and restore used memory? Is there a destructor that I could use, I tried __destruct (), but didn't seem to get the correct syntax.
Thanks C
source share