Re: huge memory usage in PHP 4.0.2 object programming?

From: Date: Sat, 16 Sep 2000 21:41:34 +0000
Subject: Re: huge memory usage in PHP 4.0.2 object programming?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-17024@lists.php.net to get a copy of this message
This has nothing to do with Apache or PHP if you're running on Unix, but is the way the memory allocation system on Unix runs. Freeing memory allocated via malloc() (using the free() call) does not release memory back to the OS, rather it marks the memory as "free for re-use". (We won't get in to anonymous mmap'ing and use the sbrk() call - we'll leave that as an exercise for our students :^) If you look at the RSS of the execution programs you will most probably notice that it is much smaller than 70 Mb after you do that manipulation that involves a 70 Mb data area. RSS is more what you care about, not the program size, especially if your OS supports lazy allocation. ----- Original Message ----- From: <vincent@aib.net> To: <php-general@lists.php.net> Sent: Friday, September 15, 2000 11:53 PM Subject: [PHP] huge memory usage in PHP 4.0.2 object programming? > Hello, > > I'm writting a program using PHP4's object feature. However after each run I found that the apache process hold up > 70M of the memory!!! In the 2nd run however it doesn't make the apache process grow to 140M, remain 70M. > > The program read 2000 records into 2000 objects from a mysql database and do some processing to produce another > 2000 objects for later use (It hasn't finish). Is PHP4 will not release memory for objects, or rather this is an apache problem? > I add unset() to the final produced objects seems still doens't free up the memory after the run. > > > Thanks for your help! Please reply a copy to my e-mail if possible! > Vincent > > ======================================================== > Brief of the enviornment: > - Debian 2.1 with Linux kernel 2.0.38 > - Apache 1.3.12 with PHP 4.0.2 running as a apache static module > - PHPLib 7.2b used in db object > > Main object types: > - db object: read records from mysql database > - object A: source object type > - object B: destination object type > - factory object: translate object A to object B > > Brief of the program: > 1) db object reads 2000 object A from a mysql database and put them into an array inside the factory object. > 2) the factory object produce 2000 object B use the 2000 object A from the array. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#17024) next »