Home > Backend Development > PHP Tutorial > How to get the total memory used by a php program from the beginning to the end of running

How to get the total memory used by a php program from the beginning to the end of running

WBOY
Release: 2016-10-19 10:40:51
Original
1210 people have browsed it

How to get the total memory used by a php program from the beginning to the end of it

Reply content:

How to get the total memory used by a php program from the beginning to the end of it

memory_get_usage This function can get the memory currently used by PHP.
memory_get_peak_usage This function can get the memory peak applied by PHP during previous processing.

Record the current memory usage through memory_get_usage when the program starts running,
Get the peak memory usage through memory_get_peak_usage at the end of the program,
The only difference between the two is the maximum memory applied during this process.

This should be what you call "total memory used", right?

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template