Re: PHP4: php_module holds memory to long !

From: Date: Wed, 10 Jan 2001 19:58:44 +0000
Subject: Re: PHP4: php_module holds memory to long !
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-43722@lists.php.net to get a copy of this message
The answer is really not so easy. I have RedHat Linux 6.2 (with standard kernel, I suppose 2.1). I tried such program in c++: //File mall.cc #include <alloc.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main() { void* v[1000]; for (int i=0;i<1000;i++) { v[i]=malloc(100000); //printf("%i. %p; ",i,v[i]); memset(v[i],i,10000); } printf("\n\nMemory allocated. Wait 20 s.\n"); sleep(20); for (int i=0;i<1000;i++) { free(v[i]); //printf("%i. ^; ",i,v[i]); } printf("\nMemory freed. Wait 20 s.\n"); sleep(20); } Then I examine it with 'top' command (then shift-M to sort by memory usage). In first 20 seconds process 'mall' is on the top with 13M, then in next 20 s it is NOT. And here is the basic difference between 'mall' and 'httpd' processes: the last are on the top ALL THE TIME. So ?

« previous php.dev (#43722) next »