php - memory_get_usage() real_size is less than allocated size -


  in php manual, know memory_get_usage(real_usage) returns amount of memory allocated php, , set real_usage true total memory allocated system, including unused pages.

  i think, real usage should greater allocated size. php script real usage less allocated size , greater allocated memory.

  my code.

function p($var, $exit = false) {     $trace = debug_backtrace();     $file = $trace[0]['file'];     $line = $trace[0]['line'];     if(is_bool($var)) {         $str = $var ? 'true' : 'false';     } else {         $str = print_r($var, true);     }     echo '<pre>';     echo $file . ' : ' . 'line #' . $line . '<br>';     echo $str;     echo '</pre>';     if($exit)         exit(); } line 226: p(memory_get_usage()); line 227: p(memory_get_usage(true)); line 228: p(memory_get_peak_usage()); line 229: p(memory_get_peak_usage(true)); 

result:

real usage less allocated memory

real usage greater allocated memory

  i wonder why happens. help.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -