title: PHP: Out of memory exception but I've already changed the memory_limit
body: <p>I was getting this error:</p>
  
  <pre><code>PHP Fatal error: Allowed memory size of X bytes exhausted
  </code></pre>
  
  <p>So, after some research I changed my php.ini file:</p>
  
  <pre><code>memory_limit: 2048M
  </code></pre>
  
  <p>The previous error message stoped but I get this error instead:</p>
  
  <pre><code>Fatal error: Out of memory (allocated 1746927616) (tried to allocate 268435456 bytes) in [path]
  </code></pre>
  
  <p>So I've got 2048M as memory limit and in my error the php file allocated 1666M and tried to allocate 256M which give 1922M. This value is smaller than my memory limit so why I am getting this error? (I've checked the php info in my IIS site and the memory limit is the one I mention before).</p>
  
  <p>Thanks :)</p>
  
  <p>EDIT:</p>
  
  <p>Right before the line in which this error ocorred I did a</p>
  
  <pre><code>echo memory_get_usage();
  </code></pre>
  
  <p>And I got:</p>
  
  <pre><code>1675848
  </code></pre>
  
  <p>The code where's the error is this:</p>
  
  <pre><code>for ($i = $startKey; $i &lt;= $endKey; $i++) {
          array_push($paginas, $files[$i]);
  }
  </code></pre>