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 ?


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to