README.ZEND_MM 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. Zend Memory Manager
  2. ===================
  3. General:
  4. --------
  5. The goal of the new memory manager (available since PHP 5.2) is to reduce memory
  6. allocation overhead and speedup memory management.
  7. The new manager's "configure" has no "--disable-zend-memory-manager" option,
  8. but it has "--enable-malloc-mm" instead. It is enabled by default in DEBUG
  9. build and disabled by default in RELEASE build. When enabled it allows selecting
  10. between malloc and emalloc at runtime so you can use internal and external memory
  11. debuggers without recompilation.
  12. Debugging:
  13. ----------
  14. Normal:
  15. $ sapi/cli/php -r 'leak();'
  16. Zend MM disabled:
  17. $ USE_ZEND_ALLOC=0 valgrind --leak-check=full sapi/cli/php -r 'leak();'
  18. Shared extensions:
  19. ------------------
  20. Since PHP 5.3.11 it is possible to prevent shared extensions from unloading so
  21. that valgrind can correctly track the memory leaks in shared extensions. For
  22. this there is the ZEND_DONT_UNLOAD_MODULES environment variable. If set, then
  23. DL_UNLOAD() is skipped during the shutdown of shared extensions.
  24. Tweaking:
  25. ---------
  26. The Zend MM can be tweaked using ZEND_MM_MEM_TYPE and ZEND_MM_SEG_SIZE environment
  27. variables. Default values are "malloc" and "256K". Dependent on target system you
  28. can also use "mmap_anon", "mmap_zero" and "win32" storage managers.
  29. $ ZEND_MM_MEM_TYPE=mmap_anon ZEND_MM_SEG_SIZE=1M sapi/cli/php ..etc.