PHP: memory_get_peak_usage (false) when should I use true?

http://php.net/manual/de/function.memory-get-peak-usage.php specify that the default value will be returned from emalloc() (a memory manager written in C ++).

When should I use true as a parameter?

+6
source share
1 answer

As far as I understand, this is the answer:

memory_get_peak_usage(true) when you need to find out about using your WHOLE application, including all sorts of overhead, etc. This is useful when you want to know how heavy your application is. true usually rounds numbers to a larger size, because you cannot just allocate 729 kilobytes from RAM, your application takes only 1024 kilobytes.

memory_get_peak_usage() convenient when you want to know which of the "methods" of execution is the easiest, so you can copy as many actions as possible into the 1024 KiloBytes that are already highlighted.

+5
source

Source: https://habr.com/ru/post/889539/


All Articles