title: Php high memory usage
body: <p>We have an old facebook app, running smoothly written in native php.</p>
  
  <p>This month we decided to rewrite it in zend-framework 2. Yesterday, after switching to new app it crashed our server with lots of out of memory errors. So we turned back to old app.</p>
  
  <p>I installed xdebug to profile the app. Using memory_get_peak_usage() function i noticed high memory usage.</p>
  
  <p>In the old app, a static page uses only 1 mb memory. But the new one using 7-8 mb approximately on the same page.</p>
  
  <p>Here's the top two rows from webgrind:</p>
  
  <pre><code>   Function                                     Invocation Count    Total Self Cost    Total Inclusive Cost
     Composer\Autoload\ClassLoader-&gt;loadClass     224                 23.31       47.20
     Composer\Autoload\ClassLoader-&gt;findFile      224                 9.57        10.23
  </code></pre>
  
  <p>Also tried tha apache's ab tool</p>
  
  <pre><code>   ab -n 50 -c 5 -C PHPSESSID=SESSIONID http://myhost.com
  </code></pre>
  
  <p>Result is:</p>
  
  <pre><code>   Percentage of the requests served within a certain time (ms)
     50%    368
     66%    506
     75%    601
     80%    666
     90%   1073
     95%   1812
     98%   2278
     99%   2278
     100%   2278 (longest request)
  </code></pre>
  
  <p>All these results from the production server not localhost.</p>
  
  <p>Is 7-8 mb for a single page normal? If not, how can i reduce it? Should i look for it in zf2 or composer?</p>
  
  <p>I can give code samples if you need. Thank you.</p>