[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [bug #18396] stack size setrlimit call interacts badly with Solaris
RE: [bug #18396] stack size setrlimit call interacts badly with Solaris/x86 kernel bug
Wed, 29 Nov 2006 00:30:10 -0500
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).