title: Force freeing memory in PHP
body: <p>In a PHP program, I sequentially read a bunch of files (with <code>file_get_contents</code>), <code>gzdecode</code> them, <code>json_decode</code> the result, analyze the contents, throw most of it away, and store about 1% in an array.</p>
  
  <p>Unfortunately, with each iteration (I traverse over an array containing the filenames), there seems to be some memory lost (according to <code>memory_get_peak_usage</code>, about 2-10 MB each time). I have double- and triple-checked my code; I am not storing unneeded data in the loop (and the needed data hardly exceeds about 10MB overall), but I am frequently rewriting (actually, strings in an array). Apparently, PHP does not free the memory correctly, thus using more and more RAM until it hits the limit.</p>
  
  <p>Is there any way to do a forced garbage collection? Or, at least, to find out where the memory is used?</p>