Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><code>real_usage</code> works this way:</p> <p>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 <code>ZEND_MM_SEG_SIZE</code>) and manages it internally. So, there are two kinds of memory usage:</p> <ol> <li>How much memory the engine took from the OS ("real usage")</li> <li>How much of this memory was actually used by the application ("internal usage")</li> </ol> <p>Either one of these can be returned by <code>memory_get_usage()</code>. Which one is more useful for you depends on what you are looking into. If you're looking into optimizing your code in specific parts, "internal" might be more useful for you. If you're tracking memory usage globally, "real" would be of more use. <code>memory_limit</code> limits the "real" number, so as soon as all blocks that are permitted by the limit are taken from the system and the memory manager can't allocate a requested block, there the allocation fails. Note that "internal" usage in this case might be less than the limit, but the allocation still could fail because of fragmentation.</p> <p>Also, if you are using some external memory tracking tool, you can set this environment variable <code>USE_ZEND_ALLOC=0</code> which would disable the above mechanism and make the engine always use <code>malloc()</code>. This would have much worse performance but allows you to use malloc-tracking tools. </p> <p>See also <a href="http://www.ibm.com/developerworks/opensource/library/os-php-v521/" rel="noreferrer">an article about this memory manager</a>, it has some code examples too.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload