1

I was reading this question

real_usage works this way:

Zend's memory manager does not use system malloc for every block it needs. Instead, it allocates a big block of system memory (in increments of 256K, can be changed by setting environment variable ZEND_MM_SEG_SIZE) and manages it internally. So, there are two kinds of memory usage:

  1. How much memory the engine took from the OS ("real usage")
  2. How much of this memory was actually used by the application ("internal usage")

The same thing can be found on the official PHP doc:

real_usage

Set this to TRUE to get total memory allocated from system, including unused pages. If not set or FALSE only the used memory is reported.

So I tested and I found that

var_dump(memory_get_usage()); //--> 4391096
var_dump(memory_get_usage(true)); //--> 2097152

So the real_usage seems 2Mb that is lower than internal usage (4Mb), how can this be possible? I understood that real_usage should be grater than internal usage. (I'm on windows, php7)

Thanks

Community
  • 1
  • 1
Stefano Giacone
  • 2,016
  • 3
  • 27
  • 50

0 Answers0