Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am not sure it's memory leakage, it must be an "out of memory" exception. My guess is that your script must be dying when reading the <strong>large file</strong>. When reading through your code I found the following:</p> <pre><code>$rows = file($thefile); </code></pre> <p>This code line will read the <strong>entire</strong> "large file" into an array in <strong>memory</strong>. The first step should be ensuring that your script isn't dying due to this. You can try using <code>fopen</code> and <code>fread</code> functions in PHP to read byte chunks and write into the destination file. This should ideally take care of hogging memory resources when reading.</p> <p>To diagnose if <code>getDataCSV()</code> is the actual culprit modify the following line:</p> <pre><code>$iter = new ArrayIterator(getDataCSV()); </code></pre> <p>in your code to this:</p> <pre><code>$iter = new ArrayIterator(getDataCSV()); die('I died after getDataCSV. There is another culprit somewhere else causing the script to fail!'); </code></pre> <p>If you get the <code>die</code> message on your browser then you should start looking at other places in your code which can kill the script.</p> <p>I haven't gone thoroughly through your code but you should also ensure you follow the same process of reading chunks of the file when processing it locally. For e.g. once your file is downloaded you will be processing it to generate some data. You may use arrays and loops to achieve it but since the data to process is large you should still be processing partial chunks of the file instead of dumping it all into memory.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload