Skip to content

Commit d520483

Browse files
realFlowControlFlorian Engelhardt
authored andcommitted
Add docs for memory_reset_peak_usage() (php#1809)
Co-authored-by: Florian Engelhardt <[email protected]>
1 parent 7688b7b commit d520483

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

reference/info/functions/memory-get-peak-usage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<para>
4949
<simplelist>
5050
<member><function>memory_get_usage</function></member>
51+
<member><function>memory_reset_peak_usage</function></member>
5152
<member><link linkend="ini.memory-limit">memory_limit</link></member>
5253
</simplelist>
5354
</para>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<refentry xml:id="function.memory-reset-peak-usage" xmlns="http://docbook.org/ns/docbook">
4+
<refnamediv>
5+
<refname>memory_reset_peak_usage</refname>
6+
<refpurpose>Reset the peak memory usage</refpurpose>
7+
</refnamediv>
8+
9+
<refsect1 role="description">
10+
&reftitle.description;
11+
<methodsynopsis>
12+
<type>void</type><methodname>memory_reset_peak_usage</methodname>
13+
<void/>
14+
</methodsynopsis>
15+
<para>
16+
Resets the peak memory usage returned by the
17+
<function>memory_get_peak_usage</function> function.
18+
</para>
19+
</refsect1>
20+
21+
<refsect1 role="parameters">
22+
&reftitle.parameters;
23+
&no.function.parameters;
24+
</refsect1>
25+
26+
<refsect1 role="returnvalues">
27+
&reftitle.returnvalues;
28+
<para>
29+
&return.void;
30+
</para>
31+
</refsect1>
32+
33+
<refsect1 role="examples">
34+
&reftitle.examples;
35+
<para>
36+
<example>
37+
<title><function>memory_reset_peak_usage</function> example</title>
38+
<programlisting role="php">
39+
<![CDATA[
40+
<?php
41+
42+
var_dump(memory_get_peak_usage());
43+
44+
$a = str_repeat("Hello", 424242);
45+
var_dump(memory_get_peak_usage());
46+
47+
unset($a);
48+
memory_reset_peak_usage();
49+
50+
$a = str_repeat("Hello", 2424);
51+
var_dump(memory_get_peak_usage());
52+
53+
?>
54+
]]>
55+
</programlisting>
56+
&example.outputs.similar;
57+
<screen>
58+
<![CDATA[
59+
int(422440)
60+
int(2508672)
61+
int(399208)
62+
]]>
63+
</screen>
64+
</example>
65+
</para>
66+
</refsect1>
67+
68+
<refsect1 role="seealso">
69+
&reftitle.seealso;
70+
<para>
71+
<simplelist>
72+
<member><function>memory_get_peak_usage</function></member>
73+
</simplelist>
74+
</para>
75+
</refsect1>
76+
77+
</refentry>
78+
<!-- Keep this comment at the end of the file
79+
Local variables:
80+
mode: sgml
81+
sgml-omittag:t
82+
sgml-shorttag:t
83+
sgml-minimize-attributes:nil
84+
sgml-always-quote-attributes:t
85+
sgml-indent-step:1
86+
sgml-indent-data:t
87+
indent-tabs-mode:nil
88+
sgml-parent-document:nil
89+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
90+
sgml-exposed-tags:nil
91+
sgml-local-catalogs:nil
92+
sgml-local-ecat-files:nil
93+
End:
94+
vim600: syn=xml fen fdm=syntax fdl=2 si
95+
vim: et tw=78 syn=sgml
96+
vi: ts=1 sw=1
97+
-->

reference/info/versions.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<function name="ini_get_all" from="PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8"/>
4343
<function name="ini_restore" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
4444
<function name="ini_set" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
45+
<function name="memory_reset_peak_usage" from="PHP 8 &gt;= 8.2.0"/>
4546
<function name="memory_get_peak_usage" from="PHP 5 &gt;= 5.2.0, PHP 7, PHP 8"/>
4647
<function name="memory_get_usage" from="PHP 4 &gt;= 4.3.2, PHP 5, PHP 7, PHP 8"/>
4748
<function name="php_ini_loaded_file" from="PHP 5 &gt;= 5.2.4, PHP 7, PHP 8"/>

0 commit comments

Comments
 (0)