<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Returns the peak of memory allocated by PHP</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.main.html">main</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.memory-get-usage.html">memory_get_usage</a></div> <div class="up"><a href="ref.info.html">PHP Options/Info Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.memory-get-peak-usage" class="refentry"> <div class="refnamediv"> <h1 class="refname">memory_get_peak_usage</h1> <p class="verinfo">(PHP 5 >= 5.2.0)</p><p class="refpurpose"><span class="refname">memory_get_peak_usage</span> — <span class="dc-title">Returns the peak of memory allocated by PHP</span></p> </div> <div class="refsect1 description" id="refsect1-function.memory-get-peak-usage-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><strong>memory_get_peak_usage</strong></span> ([ <span class="methodparam"><span class="type">bool</span> <code class="parameter">$real_usage</code><span class="initializer"> = false</span></span> ] )</div> <p class="para rdfs-comment"> Returns the peak of memory, in bytes, that's been allocated to your PHP script. </p> </div> <div class="refsect1 parameters" id="refsect1-function.memory-get-peak-usage-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">real_usage</code></em></span> <dd> <p class="para"> Set this to <strong><code>TRUE</code></strong> to get the real size of memory allocated from system. If not set or <strong><code>FALSE</code></strong> only the memory used by <em>emalloc()</em> is reported. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.memory-get-peak-usage-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the memory peak in bytes. </p> </div> <div class="refsect1 changelog" id="refsect1-function.memory-get-peak-usage-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>5.2.1</td> <td> Compiling with <a href="ini.core.html#ini.memory-limit" class="link">--enable-memory-limit</a> is no longer required for this function to exist. </td> </tr> <tr> <td>5.2.0</td> <td> <em><code class="parameter">real_usage</code></em> was added. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 seealso" id="refsect1-function.memory-get-peak-usage-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.memory-get-usage.html" class="function" rel="rdfs-seeAlso">memory_get_usage()</a> - Returns the amount of memory allocated to PHP</span></li> <li class="member"><a href="ini.core.html#ini.memory-limit" class="link">memory_limit</a></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.main.html">main</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.memory-get-usage.html">memory_get_usage</a></div> <div class="up"><a href="ref.info.html">PHP Options/Info Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>