Let’s say i call memory_get_peak_usage(true) and it returns 2.5MB.
-
Does it means that the whole php (all clients) is causing that peak?
-
Or does it means that if I have 100 clients acessing the same time, the peak could be 250MB?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It returns the peak usage for the current request only.
To remove any ambiguities from the docs:
memory_get_peak_usage() calls the internal zend_memory_peak_usage() function, which returns
AG(mm_heap)->peak.AG(mm_heap)->peakis reset to0in zend_mm_shutdown(), which is called in php_request_shutdown() at the end of each request.So it’s the peak memory usage for the current request only.