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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: short at k332 dot feld dot cvut dot cz
New email:
PHP Version: OS:

 

 [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 Feb 21 01:01:26 2020 UTC