当前位置: 动力学知识库 > 问答 > 编程问答 >

memory - PHP: memory_get_peak_usage(false), when should i use true?

问题描述:

http://php.net/manual/de/function.memory-get-peak-usage.php

point out that by default the value from emalloc() (memory manager written in c++) will be returned.

In what cases should I use true as parameter?

网友答案:

As far as my understanding goes here is the answer:

memory_get_peak_usage(true) when you need to find out the WHOLE usage of your app, including all kinds of overheads and etc. It's handy when you want to find out how heavy your app is. true usually rounds up numbers to the bigger size, because you can't just allocate 729 KiloBytes from RAM, your app takes whole 1024 KiloBytes.

memory_get_peak_usage() is handy when you want to find out which 'method' of execution is most lightweight, so you can cram as much actions as possible into the 1024 KiloBytes that are already allocated.

分享给朋友:
您可能感兴趣的文章:
随机阅读: