This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Use malloca instead alloca
> x86 version
> linux/arch/x86/mm/mmap.c
> -----------------------------------------------------------------
> static unsigned long mmap_base(void)
> {
> unsigned long gap = rlimit(RLIMIT_STACK);
>
> if (gap < MIN_GAP)
> gap = MIN_GAP;
> else if (gap > MAX_GAP)
> gap = MAX_GAP;
>
> return PAGE_ALIGN(TASK_SIZE - gap - mmap_rnd());
> }
One more thing. mmap_base is calculated at process creation time. However
RLIMIT_STACK is used when actual stack expansion. then weird scenario might
occur when process changes RLIMIT_STACK dynamically.