Home  >  Article  >  Backend Development  >  How to obtain the amount of PHP memory cleared using the php memory_get_usage() function

How to obtain the amount of PHP memory cleared using the php memory_get_usage() function

怪我咯
怪我咯Original
2017-07-13 14:04:102518browse

memory_get_usage --Returns the amount of memory currently allocated to your PHP script, in bytes.

int memory_get_usage ([ bool $real_usage = false ] )


real_usage

If set to TRUE, get the total memory size allocated by the system, including unused pages. If not set or set to FALSE, only the actual amount of memory used is reported.

Basic usage and examples
1, get the current memory consumption

Respectively output: 62328 122504 62416
Description: memory_get_usage() function output The value is in bytes unit

2, formatted memory_get_usage() output

Output: 256 kb

3, Custom functionGet the array or Variable value size

The above is the detailed content of How to obtain the amount of PHP memory cleared using the php memory_get_usage() function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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