[dev] WG: [PHP-DEV] Memory usage and big arrays

Jan Schneider jan at horde.org
Tue Feb 27 08:20:43 PST 2007


Interesting. Probably another good reason to always $a = array(....).

----- Weitergeleitete Nachricht von brianm at dealnews.com -----
      Datum: Mon, 26 Feb 2007 14:05:01 -0600
        Von: Brian Moon <brianm at dealnews.com>
    Betreff: [PHP-DEV] Memory usage and big arrays
         An: internals at lists.php.net

I was doing some testing with some cache files we use and found some  
shocking memory usage with big arrays.  Basically, when creating a  
large array in a verbose manner using $CATEGORIES[2]["name"] = "foo";  
syntax, the memory usage was much higher than other methods.  For the  
particular file I was using, it was 5MB (verbose code) vs. 1.1MB  
(var_export format) vs. 900k (serialized).

All my test code is at http://dev.phorum.org/bigarray.tar.gz and more  
details are in my blog post at  
http://doughboy.wordpress.com/2007/02/26/big-arrays-in-php/.

I didn't want to post this to the bug list as I don't know that it is  
a bug.  This may be expected behavior.  But, I figured it would not  
hurt to point it out.  Maybe something obvious can be done to fix  
this?  I am not an advanced C coder or I would dig in to the code  
myself.

-- 

Brian Moon
-------------
http://dealnews.com/
It's good to be cheap =)

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


----- Ende der weitergeleiteten Nachricht -----


Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/
-------------- next part --------------
An embedded message was scrubbed...
From: Brian Moon <brianm at dealnews.com>
Subject: [PHP-DEV] Memory usage and big arrays
Date: Mon, 26 Feb 2007 14:05:01 -0600
Size: 4518
Url: http://lists.horde.org/archives/dev/attachments/20070227/96a308b2/attachment.mht


More information about the dev mailing list