|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #50333 [PATCH] - Improving multi-threaded scalability by using emalloc/efree/estrdup
Submitted: 2009-11-30 12:45 UTC Modified: 2013-11-05 18:32 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: yoarvi at gmail dot com Assigned: ab (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 6SVN-2009-11-30 (SVN) OS: Solaris 5.10 (SPARC)
Private report: No CVE-ID: None
 [2009-11-30 12:45 UTC] yoarvi at gmail dot com
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

Rename TSRM/tsrm_virtual_cwd.[ch] to Zend/zend_virtual_cwd.[ch]

Replace malloc/free/strdup with emalloc/efree/estrdup


Expected result:
Improved scalability on multi-threaded/multi-core systems.


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-24 10:14 UTC]
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2013-10-14 10:03 UTC]
-Assigned To: +Assigned To: ab
 [2013-10-14 13:51 UTC]
@a will review/update the patch.

We will then run all required tests before applying it to master (discussed with Dmitry too).
 [2013-11-05 18:32 UTC]
-Status: Assigned +Status: Closed
 [2013-11-05 18:32 UTC]
the pull request merged
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Mar 04 03:01:30 2024 UTC