This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: pthread_exit behavior from main
On Thu, Oct 4, 2012 at 10:15 PM, Siddhesh Poyarekar
<siddhesh.poyarekar@gmail.com> wrote:
> (Sorry, accidentally did a Reply instead of Reply All)
>
> On 5 October 2012 07:11, Godmar Back <godmar@gmail.com> wrote:
>> Just out of curiosity, why do you madvise it with MADV_DONTNEED rather
>> than munmapping it outright?
>
> That's a performance tweak. The pthread library caches a specific
> number of stacks so that they can be reused by new threads, thus
> avoiding the need for repeated syscalls.
Right, I'd forgotten all about that.
When we hit the 40MB static limit in allocatestate we call __free_stacks
which *does* call munmap for the stack.
Cheers,
Carlos.