memory_reset_peak_usage()

memory_reset_peak_usage() — Reset the peak memory usage.

Built-in function of PHP 8.5. The manual lists it as available in PHP 8 >= 8.2.0. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

Resets the peak memory usage returned by the memory_get_peak_usage() function.

Signature

memory_reset_peak_usage(): void

Parameters

This function takes no parameters.

Return value

No value is returned.

Example

A runnable snippet:

var_dump(memory_get_peak_usage()); $a = str_repeat("Hello", 424242); var_dump(memory_get_peak_usage()); unset($a); memory_reset_peak_usage(); $a = str_repeat("Hello", 2424); var_dump(memory_get_peak_usage());

Output:

int(422440) int(2508672) int(399208)

See also

memory_get_peak_usage()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page memory_reset_peak_usage() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.