In data mercoledì 15 giugno 2011 14:22:53, giantkiar@??? ha scritto:
> Voi vedere qualcosa di anomalo?
Sì, il tuo codice è incomprensibile :)
cmq. stano alla man page del comando getrusage:
       The  structure  definition  shown at the start of this page was taken 
from 4.3BSD Reno.  Not all fields are meaningful under Linux.  In Linux 2.4
       only the fields ru_utime, ru_stime, ru_minflt, and ru_majflt are 
maintained.  Since Linux 2.6, ru_nvcsw and ru_nivcsw are also maintained.  
Since
       Linux 2.6.22, ru_inblock and ru_oublock are also maintained.
non credo che i valori di ru_maxrss siano affidabili, o cmq. non rappesentano 
quello che immagini:
puoi verificarlo con questo test:
http://pastie.org/2072112
durante i primi 10 secondi:
megabug@squaqquerone:~$ ps axu|grep test|grep -v grep
megabug  31133  5.0  0.9  22428 20340 pts/3    S+   14:53   0:00 ./test
dopo:
megabug@squaqquerone:~$ ps axu|grep test|grep -v grep
megabug  31133  0.3  0.0   2896   916 pts/3    S+   14:53   0:00 ./test
quando invece l'output del programma è:
megabug@squaqquerone:~$ ./test 
maxrss: 3876
post-map: 20340
post-clear: 20340
come vedi il valore non scende a 916 come invece riportato correttamente dal 
comando ps.
-- 
megabug