mirror of
https://github.com/php/php-src.git
synced 2024-11-28 04:14:26 +08:00
35 lines
1.0 KiB
Plaintext
35 lines
1.0 KiB
Plaintext
Zend Memory Manager
|
|
===================
|
|
|
|
General:
|
|
--------
|
|
|
|
The goal of the new memory manager (available since PHP 5.2) is to reduce memory
|
|
allocation overhead and speedup memory management.
|
|
|
|
The new manager's "configure" has no "--disable-zend-memory-manager" option,
|
|
but it has "--enable-malloc-mm" instead. It is enabled by default in DEBUG
|
|
build and disabled by default in RELEASE build. when enabled it allows selecting
|
|
between malloc and emalloc at runtime so you can use internal and external memory
|
|
debuggers without recompilation.
|
|
|
|
Debugging:
|
|
----------
|
|
|
|
Normal:
|
|
|
|
$ sapi/cli/php -r 'leak();'
|
|
|
|
Zend MM disabled:
|
|
|
|
$ USE_ZEND_ALLOC=0 valgrind --leak-check=full sapi/cli/php -r 'leak();'
|
|
|
|
Tweaking:
|
|
---------
|
|
|
|
The Zend MM can be tweaked using ZEND_MM_MEM_TYPE and ZEND_MM_SEG_SIZE environment
|
|
variables. Default values are "malloc" and "256K". Dependent on target system you
|
|
can also use "mmap_anon", "mmap_zero" and "win32" storage managers.
|
|
|
|
$ ZEND_MM_MEM_TYPE=mmap_anon ZEND_MM_SEG_SIZE=1M sapi/cli/php ..etc.
|