Re: memory allocation and de-allocation

From: Date: Wed, 13 Mar 2002 10:13:45 +0000
Subject: Re: memory allocation and de-allocation
References: 1 2 3 4  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-1496@lists.php.net to get a copy of this message
too sweet, this works nicely with the example code I supplied, soon as I use unset, poof, the memory drops to nothing again. now in the real life code I'm working on, I allocate stuff to a clist in php-gtk and when I unset the clist the memory remains consumed, this is the same for removing any widget, I remove it, unset it and the memory still remains. Any ideas? This is the only thing that holds me from porting a call center system I wrote from php cgi to php-gtk. brett > Theres another one to tryin zend_fast_cache.h try adding this near the > beginning > # define ZEND_ENABLE_FAST_CACHE 0 > > theres a few macros in there that do wonderfull things if > zend_enable_fast_cache is on... > - and do good ole efree etc. if not. > > Brett Geer wrote: > > >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 (#1496) next »