ulimit -S of stack size:
linux-i386:     8 MB
linux-amd64:    8 MB
kfreebsd-i386:  8 MB
kfreebsd-amd64: 8 MB

ulimit -H of stack size:
linux-i386:     unlimited
linux-amd64:    unlimited
kfreebsd-i386:  64 MB
kfreebsd-amd64: 512 MB


*******************************

From {nptl/fbtl}/nptl-init.c

  /* Determine the default allowed stack size.  This is the size used
     in case the user does not specify one.  */
  struct rlimit limit;
  if (getrlimit (RLIMIT_STACK, &limit) != 0
      || limit.rlim_cur == RLIM_INFINITY)
    /* The system limit is not usable.  Use an architecture-specific
       default.  */
    limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
  else if (limit.rlim_cur < PTHREAD_STACK_MIN)
    /* The system limit is unusably small.
       Use the minimal size acceptable.  */
    limit.rlim_cur = PTHREAD_STACK_MIN;
...
2.17:
   __default_stacksize = limit.rlim_cur;

2.18:
   __default_pthread_attr.stacksize = limit.rlim_cur;

For {linux,kfreebsd}-{i386,amd64}

PTHREAD_STACK_MIN               16 KB
ARCH_STACK_DEFAULT_SIZE          2 MB

*******************************

The make raises soft limit of stack size to hard limit of stack size.

*******************************

As a result of above, under linux, each thread needs only 2 MB for its stack, while under kfreebsd each thread needs virtual space for either 64 MB or 512 MB.

It looks like reasonable approach will be to put also upper bound
to __default_stacksize, let say to 4*ARCH_STACK_DEFAULT_SIZE (= 4*2MB)

Petr


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to