gisle@struts.ii.uib.no (Gisle S�lensminde) writes: > gisle@gekko:116> time heap > Time: 0:53.92 real 31.250 user 12.190 sys 80.5% > > gisle@gekko:120> time stack > Time: 0:11.02 real 10.490 user 0.030 sys 95.4% > > The stack program was 3 times faster if you consider user times. > In my tests the system time used was always at least 11 seconds, > while the stack program never used more than 0.05 seconds. The > system have to work harder when using heap allocation, which makes > the heap program run in only 1/4th of the time of the stack program. The huge amount of used system time is interesting, since the allocated data is always of the same size - there shouldn't be any need for another system call after the first "new". Unless the "free" releases the memory back to the operating system. (Most of C library implementations I've seen do not usually shrunk the process' heap on free()). -- Aaro Koskinen, aaro@iki.fi, http://www.iki.fi/aaro