The PHP manual says:
int memory_get_peak_usage ([ bool $real_usage = false ] )
Returns the peak of memory, in bytes, that's been allocated to your PHP script.
Parameters
real_usage
Set this to TRUE to get the real size of memory allocated from system. If not set or FALSE only the memory used by emalloc() is reported.
So how is emalloc()
not a real usage, and how does TRUE
compute the real memory usage then?
This question on StackOverflow asks the same thing, but the only answer doesn't dive into details about how computation is done, apart from rounding some allocations to the next kilobyte.
Any more extensive answer on what's happening under the hood when you use FALSE
and TRUE
?