Re: memory allocation and de-allocation

From: Date: Tue, 12 Mar 2002 13:14:58 +0000
Subject: Re: memory allocation and de-allocation
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-1489@lists.php.net to get a copy of this message
eh just tried this, still hogging memory, php 4.1.1 with the gtk extension 0.5.0 I also tried the ZEND_DISABLE_CACHE to 1 in the zend_alloc.h no go... Though I understand that with apache this wouldn't be a huge issue since the scripts are over pretty fast in my case, I'm working on a client that runs under php-gtk for this, and it gets bad when I start selecting loads of data back into lists, basic movement thru forms isn't too bad, few k at a time hardly worries me. With a small C program to alloc and then free the ram I noted the memory usage go up and down again, I also know that some nix's don't release the ram until the app dies, apparently AIX 4.3 does this at some maintenance levels brett > advice from up above (not me :) > > try changing this in Zend/zend_alloc.c > > #define MAX_CACHED_MEMORY 11 > #define MAX_CACHED_ENTRIES 256 > #define PRE_INIT_CACHE_ENTRIES 32 > > to > > > #define MAX_CACHED_MEMORY 1 > #define MAX_CACHED_ENTRIES 1 > #define PRE_INIT_CACHE_ENTRIES 1 > > > - this should tell php to not cache the memory (dont forget that php > assumes that another apache process may want to use that memory :) > > regards > alan > > > > Brett Geer wrote: > > >Porting one of my apps to php-gtk from the web interface I noted that the memory usage > >of the app just kept on going up, after a little digging I discovered: > > > ><? > > > > function allocate_some () > > { > > for ($loop = 0; $loop <= 100000; $loop++) > > $some_array [$loop] = "This is a string to use up space"; > > } > > > >?> > > > >will grab a chunk of memory and not release it until script completion, I've tried > >pop'ing the array and unset'ing the array and even setting the array to a null > >with $some_array = NULL > > > >With no success. Is there any way to free the memory from a variable, most of my > >program runs with little memory usage, however one or two functions pull back > >big lists of data. > > > >brett > > > > >

« previous php.gtk.general (#1489) next »