RE: [PHP-DEV] hi memory usage with php-cli

From: Date: Sun, 24 Nov 2002 19:08:45 +0000
Subject: RE: [PHP-DEV] hi memory usage with php-cli
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-91501@lists.php.net to get a copy of this message
Hi, For your $product array, are you using associative keys on each, so like: $product = array('name' => $name, 'art.no' => $artnum, ... ); If so, you might find that if you replaced the string keys with constants, you would save memory, because a constant is an integer and takes less storage space than a string. Example: <?php define(PROD_NAME, 0); define(PROD_ARTNUM, 1); # ... $product = array(PROD_NAME => $name, PROD_ARTNUM => $artnum, ... ); ?> I think that might save you some memory. Just an idea. ---- Pete -----Original Message----- From: Robin Ericsson [mailto:lobbin@localhost.nu] Sent: November 24, 2002 12:20 PM To: php-dev@lists.php.net Subject: [PHP-DEV] hi memory usage with php-cli Hi, I have a huge xml-file with about 500k lines, which gives around 17000 products, which I import to a database. The problem is that the script is taking a lot of memory, about 100mb when it's finished. The script goes something like this $product = array(), then I add some values to the array, name, art.no, and when the product is done, I do $product = array(), and do the same thing over and over. Is there any way to configure php/zend to use less memory? I've tried #define ZEND_DISABLE_MEMORY_CACHE 1 which doesn't help. best regards Robin -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.dev (#91501) next »