It returns maximum usage only for the current request.
From the doc :
Returns the memory peak in bytes that has been allocated for your PHP script.
To remove any uncertainties from documents:
memory_get_peak_usage () calls the internal function zend_memory_peak_usage () , which returns AG(mm_heap)->peak .
AG(mm_heap)->peak reset to 0 in zend_mm_shutdown () , which is called in php_request_shutdown () at the end of each request.
Thus, this is the maximum memory usage for the current request.
arnaud576875 Aug 29 '11 at 18:12 2011-08-29 18:12
source share