On Tue, 2006-11-28 at 18:45 -0800, Martin Dorey wrote: > > Using heap, which requires a system call to get more memory > > (It doesn't affect the main point of Paul's reply but just for academic > interest) no it doesn't:
> Even in less contrived applications, brk isn't called anything like as > often as malloc. Certainly that's true... I didn't mean to suggest every call to malloc() resulted in a system call. But using the heap DOES require a system call to get memory... obviously the C runtime will grab memory in much larger chunks and maintains a free pool, with algorithms to handle fragmentation and coalescing of free blocks, etc. There are whole dissertations written on the most efficient ways to manage heap :). But (as I'm sure we both agree) alloca() is unquestionably more efficient (assuming you have an appropriate amount of stack). _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make