php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3678 array overhead not good
Submitted: 2000-03-01 05:17 UTC Modified: 2000-03-01 12:25 UTC
From: wico at cnh dot nl Assigned:
Status: Closed Package: Performance problem
PHP Version: 4.0 Latest CVS (01/03/2000) OS: guess every :)
Private report: No CVE-ID: None
 [2000-03-01 05:17 UTC] wico at cnh dot nl
this is what i did:


<?
        for ($x = 0; $x < 500000; $x++) {
                $test[$x] = "";
        }


        echo "DONE<BR>\n"; flush();
        sleep(60);
?>
after running this i found apache useing 65MB of memmory
25520 nobody     0   0 67212  65M  2180 S       0  0.0 26.0   0:04 httpsd


and it doesn't matter if you do this:


$test[$x] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AA";


it keeps 65MB


I find this strange...

Keep up the good work

Greetz,

Wico

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-03-01 12:25 UTC] andi at cvs dot php dot net
All arrays in PHP are associative arrays which means that the memory overhead is fairly bigger than a regular array in say, C. In any case, did you compile with --disable-debug? It should make some difference.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Mar 29 13:01:26 2020 UTC