What is the difference between the functions memory_get_usage
and memory_get_peak_usage
?
Do the two do the same or are there any differences between them?
What is the difference between the functions memory_get_usage
and memory_get_peak_usage
?
Do the two do the same or are there any differences between them?
memory_get_usage
is the amount of memory being used at that time.
memory_get_peak_usage
is the maximum amount of memory reached during the entire execution of the script.
memory_get_usage
: Returns the amount of memory allocated for PHP.
memory_get_peak_usage
: Returns the peak memory allocated by PHP.
And the directive:
memory_limit
: php.ini
directive that defines the amount maximum byte memory that a script is allowed to allocate.