title: PHP SimpleXML large file no extra memory usage
body: <p>In every article about SimpleXML performance and memory usage it is mentioned that all parsed content is stored in memory and that processing large files will lead to large memory usage.
  But recently I found that processing large files with SimpleXML do not cause large memory usage even more it causes almost none memory usage.
  There is my test script:</p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL);
  ini_set("display_errors", 1);
  print "OS: " . php_uname() . "\n";
  print "PHP version: " . phpversion() . "\n";
  
  print round(memory_get_usage() / 1024 / 1024, 2) . " Mb\n";
  $large_xml = '&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;catalog&gt;&lt;products&gt;';
  for ($i = 0; $i &lt; 500000; $i++) {
      $large_xml .= "&lt;product&gt;&lt;id&gt;{$i}&lt;/id&gt;&lt;name&gt;Product Name {$i}&lt;/name&gt;&lt;description&gt;Some Description {$i}&lt;/description&gt;&lt;price&gt;{$i}&lt;/price&gt;&lt;/product&gt;\n";
  }
  $large_xml .= "&lt;/products&gt;&lt;/catalog&gt;";
  print round(memory_get_usage() / 1024 / 1024, 2) . " Mb\n";
  $products_sxml = simplexml_load_string($large_xml);
  print round(memory_get_usage() / 1024 / 1024, 2) . " Mb\n";
  ?&gt;
  </code></pre>
  
  <p>I was tesing this script on Linux server, PHP version: 5.3.8 and the output was:</p>
  
  <p>OS: Linux 2.6.32-5-amd64 #1 SMP Mon Feb 25 00:26:11 UTC 2013 x86_64</p>
  
  <p>PHP version: 5.3.8</p>
  
  <p>0.6 Mb</p>
  
  <p>65.98 Mb</p>
  
  <p>65.98 Mb</p>
  
  <p>So my question is - does anyone else has noticed it and what could be an explanation to this it, because I could not find anywhere in the web the explanaition of it - not even an confirmation about it?</p>