Memory usage and big arrays

From: Date: Mon, 26 Feb 2007 20:05:01 +0000
Subject: Memory usage and big arrays
Groups: php.internals 
Request: Send a blank email to internals+get-28160@lists.php.net to get a copy of this message
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 =)

« previous php.internals (#28160) next »