Out of memory: system();

Markku Kolkka markkukolkka at kolumbus.fi
Sat Jun 12 12:39:46 UTC 2004


Ed K. kirjoitti viestissään (lähetysaika lauantai, 12. kesäkuuta 
2004 02:11):
> I do have a working test:
>
> #include <stdio.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <errno.h>
>
> int main(int argc, char *argv[])
> {
>    unsigned char *data;
>    int i;
>
>    data=malloc(500*1024*1024);
>    memset(data,0,500*1024*1024);
>
>    for (i=0; i<100000; i++)
>      system("cat /proc/meminfo");
> }
>
> This does not cause problems on FC1 (kernel 2.4.22-1.2188) But
> does on FC2 (kernel 2.6.5-1.358)

I ran this program successfully on FC2 with kernel 2.6.6-1.424, 
512MB RAM and 1GB swap. No signs of memory leaking.

-- 
	Markku Kolkka
	markku.kolkka at iki.fi





More information about the fedora-list mailing list