RE: [PHP] huge memory usage in PHP 4.0.2 object programming?

From: Date: Sun, 17 Sep 2000 06:15:16 +0000
Subject: RE: [PHP] huge memory usage in PHP 4.0.2 object programming?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-17062@lists.php.net to get a copy of this message
For a lot of small memory allocations, long-running Unix processes will not be able to return memory to the OS. When memory is freed in the process it is marked for re-use, but only for that same process. So, a long-running process like an Apache httpd process, it will tend to grow and stay at the largest amount of memory it has allocated. And yes, you should try to avoid loading huge data sets into memory. -Rasmus On Sun, 17 Sep 2000, Vincent W.S. Tam wrote: > Hi Rasmus, > > Thanks for your advise, I'll think about changing the logic to > process on-demand instead of store a huge data set in memory. > > By the way, if the object has problem to be a data store, will > it get fixed if I use an array to replace it? > > Or I should in general prevent working with large dataset in > PHP apache module programming because this is the way it works > in the apache enviornment? I found that our apache web servers > with PHP powered, their RSS (usually 6-8M after weeks run) never > drop back to the starting point (~2-3M). > > > Thanks for your help! > Vincent > > -----Original Message----- > From: Rasmus Lerdorf [mailto:rasmus@php.net] > Sent: Sunday, September 17, 2000 1:37 PM > To: Vincent W.S. Tam > Cc: 'Mark Charette'; php-general@lists.php.net > Subject: RE: [PHP] huge memory usage in PHP 4.0.2 object programming? > > > > 2) the result of "free", note the 24M swap usage > > > > total used free shared buffers cached > > Mem: 127760 126640 1120 20444 384 6312 > > -/+ buffers/cache: 119944 7816 > > Swap: 130748 24948 105800 > > > > I hope there is some other ways to fix it!? (Don't write object in PHP?) > > No, objects work fine, but don't use objects as a datastore. Rethink your > logic and manipulate your large datasets in the database. Creating > thousands of objects in memory doesn't make much sense to me. > > -Rasmus > > >

« previous php.general (#17062) next »