This is the mail archive of the mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] __libc_alloca_cutoff (aka make mysql and others appswith very low RLIMIT_STACK setting happy)

> Hash: SHA1
> Jakub Jelinek wrote:
> > --- libc/include/alloca.h.jj	2002-09-30 16:45:04.000000000 +0200
> > +++ libc/include/alloca.h	2002-10-08 00:12:01.000000000 +0200
> > @@ -11,4 +11,16 @@ extern void *__alloca (size_t __size);
> >  # define __alloca(size)	__builtin_alloca (size)
> >  #endif /* GCC.  */
> >  
> > +extern size_t __libc_alloca_cutoff;
> > +libc_hidden_proto (__libc_alloca_cutoff)
> We should have this variable per-thread (use __thread).  Tis way a few
> worker threads using very small stack do not affect to whole process.

Conversely instead of a variable we could have a function that's given the
size and returns whether to use alloca or malloc.  The libc version can
just say to always use alloca, I don't care about supporting tiny
RLIMIT_STACK values for single-threaded programs.  The libpthread version
can look at the thread's stack size vs the allocation, and perhaps even
look at the current stack depth.  Then we don't have to diddle setrlimit
and all the rest, or add the word of TLS data

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]