php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #174 httpd process with PHP3 compiled in grow in size to approx. 100MB (wastefully)
Submitted: 1998-03-14 21:17 UTC Modified: 1998-03-17 22:56 UTC
From: short at k332 dot feld dot cvut dot cz Assigned:
Status: Closed Package: Performance problem
PHP Version: 3.0 Latest CVS OS: Linux: RedHat-5.0/Kernel-2.1.88
Private report: No CVE-ID: None
 [1998-03-14 21:17 UTC] short at k332 dot feld dot cvut dot cz
During several hash manipulations (e.g. mainly copy) the current PHP code approx. doubles the has table size during EACH copy. Such httpd becomes quickly unusable as the size grows to 100MB (in my case) and it starts swapping. Solution (=bugfix IMHO) is simple:
-----------------------snip-snip--------------------------
--- php-cvs/hash.c-orig Sun Mar 15 09:50:43 1998
+++ php-cvs/hash.c      Sun Mar 15 09:51:23 1998
@@ -64,7 +64,7 @@
        uint i;

        for (i = 0; i < nNumPrimeNumbers; i++) {
-               if (nSize < PrimeNumbers[i]) {
+               if (nSize <= PrimeNumbers[i]) {
                        nSize = PrimeNumbers[i];
                        ht->nHashSizeIndex = i;
                        break;
-----------------------snip-snip--------------------------
Thanks for source-available excellent language!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-03-17 22:56 UTC] ars
Fixed by andi
diffs at http://ca.php.net/cvsweb.cgi/hash.c?r1=1.76&r2=1.77
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Apr 10 19:01:24 2020 UTC