Using malloc/free in a multi-threaded process limits its scalability because of the process-wide lock inside malloc/free. The scalability of the PHP engine in a multi-threaded process can be improved by reducing the use of malloc/free/strdup and instead using emalloc/efree/estrdup wherever possible (at least in the main request processing code paths).
The code paths in TSRM/tsrm_virtual_cwd.c are invoked quite frequently and they use malloc/free/strdup. I'd like to submit the following patches (based on the PHP6 source tree) for review that incorporate the use of emalloc/efree/estrdup in the virtual_cwd code paths. In order to use emalloc/efree I had to relocate tsrm_virtual_cwd.c from the TSRM directory to the Zend directory. I've split the change into 3 patches in order to make the changes easy to see Avoid name clash between global and local variable (http://bugs.php.net/bug.php?id=50101) http://bitbucket.org/arvi/arviq/src/tip/arvi-08-namespace Rename TSRM/tsrm_virtual_cwd.[ch] to Zend/zend_virtual_cwd.[ch] http://bitbucket.org/arvi/arviq/src/tip/arvi-08-virtual_cwd Replace malloc/free/strdup with emalloc/efree/estrdup http://bitbucket.org/arvi/arviq/src/tip/arvi-08-virtual_cwd-emalloc Thanks, Arvi -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php