This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


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: thread heap leak?


On 3/28/19 2:17 PM, David Muse wrote:
I just remembered something...

You mentioned 2mb or 8mb stack ulimits.  The default is 8mb, but we're using:
ulimit -s unlimited

on the production VM.  Could this be contributing to the problem?

No, that's not likely the problem.

Thread stacks are allocated with mmap, and in the presence of an unlimited
ulimit they fall back to the default size which is 2MiB.

nptl/nptl-init.c:

350   /* Determine the default allowed stack size.  This is the size used
351      in case the user does not specify one.  */
352   struct rlimit limit;
353   if (__getrlimit (RLIMIT_STACK, &limit) != 0
354       || limit.rlim_cur == RLIM_INFINITY)
355     /* The system limit is not usable.  Use an architecture-specific
356        default.  */
357     limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
                         ^^^^^^^^^^^^^^^^^^^^^^^

358   else if (limit.rlim_cur < PTHREAD_STACK_MIN)
359     /* The system limit is unusably small.
360        Use the minimal size acceptable.  */
361     limit.rlim_cur = PTHREAD_STACK_MIN;

sysdeps/x86_64/nptl/pthreaddef.h

 19 /* Default stack size.  */
 20 #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)

--
Cheers,
Carlos.


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