cURL loop memory growth <p>I have this problem with a loop using cURL where memory grows exponentially. In this example script, it starts using approximately 14MB of memory and ends with 28MB, with my original script and repeating to 1.000.000, memory grows to 800MB, which is bad.</p> <p>PHP 5.4.5<br/> cURL 7.21.0</p> <pre><code>for ($n = 1; $n &lt;= 1000; $n++){ $apiCall = 'https://api.instagram.com/v1/users/' . $n . '?access_token=5600913.47c8437.358fc525ccb94a5cb33c7d1e246ef772'; $options = Array(CURLOPT_URL =&gt; $apiCall, CURLOPT_RETURNTRANSFER =&gt; true, CURLOPT_FRESH_CONNECT =&gt; true ); $ch = curl_init(); curl_setopt_array($ch, $options); $response = curl_exec($ch); curl_close($ch); unset($ch); } </code></pre>