title: Peak memory usage of code block?
body: <p>Is it possible to get the peak memory usage of a particular block of code in PHP?  The <a href="http://php.net/manual/en/function.memory-get-peak-usage.php" rel="nofollow"><code>memory_get_peak_usage()</code></a> function seems to get the peak over the entire process execution up to the point of the function call, but this is not what I'm trying to obtain, since other code blocks could have skewed the value.  I'm trying to isolate code blocks themselves, rather than the process as a whole.</p>
  
  <p>Example:</p>
  
  <pre><code>// Block 1
  for ($i = 0; $i &lt; $iterations; ++$i) {
      // some code
  }
  
  // Block 2
  for ($i = 0; $i &lt; $iterations; ++$i) {
      // some different code
  }
  
  // Determine which of the two blocks used the most memory during their execution here
  </code></pre>
  
  <p>Unfortunately, xdebug is not an option for me at this time.</p>