RE: [PHP-GENERAL] Memory problem with large array
| From: | Christopher Thompson | Date: | Mon, 29 May 2000 23:46:39 +0000 |
| Subject: | RE: [PHP-GENERAL] Memory problem with large array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-574@lists.php.net to get a copy of this message | ||
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
>
>