1

linux server is Paralysis! ;-( malloc function [closed]

view story
linux-howto

http://serverfault.com – vmware fedora 13 x86 server $cat memory.c #include <stdio.h> #include <stdlib.h> main() { char *memory; int size=1024; int m=0; int i=0; sleep(60); while(1) { for(i=0;i<1024;i++){ memory = (char *)malloc(size); if(memory == NULL) exit(-1); sprintf(memory, "i love memoney!\n"); } m++; printf("%dm\n",m); } sleep(80); exit(0); } $./memory& task *100 [1~100] and after 1min. ... 739m 1m 1m 1m 2m 3m 2m 29m 4m 5m 1m 1m 6m 2m 30m 3m (HowTos)