Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:28160 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33693 invoked by uid 1010); 26 Feb 2007 20:05:16 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 33678 invoked from network); 26 Feb 2007 20:05:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Feb 2007 20:05:16 -0000 Authentication-Results: pb1.pair.com header.from=brianm@dealnews.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=brianm@dealnews.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain dealnews.com designates 129.41.69.185 as permitted sender) X-PHP-List-Original-Sender: brianm@dealnews.com X-Host-Fingerprint: 129.41.69.185 smtp.dealnews.com Linux 2.5 (sometimes 2.4) (4) Received: from [129.41.69.185] ([129.41.69.185:40630] helo=smtp.dealnews.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1D/31-24960-97D33E54 for ; Mon, 26 Feb 2007 15:05:14 -0500 Received: (qmail 29999 invoked from network); 26 Feb 2007 15:05:08 -0500 Received: from unknown (HELO mail.dealnews.com) (10.1.1.7) by -H with (DHE-RSA-AES256-SHA encrypted) SMTP; 26 Feb 2007 15:05:08 -0500 Received: (qmail 21111 invoked from network); 26 Feb 2007 15:05:08 -0500 Received: from unknown (HELO ?10.1.6.4?) (brianm@71.31.233.4) by -H with ESMTPA; 26 Feb 2007 15:05:08 -0500 Message-ID: <45E33D6D.906@dealnews.com> Date: Mon, 26 Feb 2007 14:05:01 -0600 User-Agent: Thunderbird 2.0b2 (Macintosh/20070116) MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Memory usage and big arrays From: brianm@dealnews.com (Brian Moon) 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 =)