RE: [PHP-GENERAL] Memory problem with large array

From: Date: Tue, 30 May 2000 04:07:15 +0000
Subject: RE: [PHP-GENERAL] Memory problem with large array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-582@lists.php.net to get a copy of this message
Make sure you compile with --disable-debug. It will help things quite a bit although as arrays in PHP are associative arrays it won't be an amazing difference. Andi At 04:46 PM 5/29/00 -0700, Christopher Thompson wrote:
Ignoring the fact that you are filling up an array of half a million items, and not knowing what your processor word size is, I would guess that it is taking more memory than the 4-8 bytes per integer you were expecting because PHP stores all arrays as hashes. -----Original Message----- From: root@elm.he.net [mailto:root@elm.he.net]On Behalf Of Jeff Morrow Sent: Monday, May 29, 2000 11:13 AM To: php-general@lists.php.net Subject: [PHP-GENERAL] Memory problem with large array Why does this script: unset($resultArray); for ($i = 0; $i < 500000; $i++) $resultArray[] = 1000; take up roughly 32 megs before ending? That seems really wrong to me... (I'm using PHP 4.0.0 and apache 1.3.3 on RedHat 6). Jeff Morrow -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.general (#582) next »