Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 May 2004 04:48:31 -0400
From:      "Joseph Gleason" <dot@fireduck.com>
To:        <freebsd-questions@freebsd.org>
Subject:   64mb stack size limit?
Message-ID:  <000e01c43990$3bf36fe0$08695f0a@frigate>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Short question:
Is there a way to increase the stack size limit for a user
process beyond 64mb?

Background:
FreeBSD in question is 5.2.1-RELEASE.

I am running an application (unison from
/usr/ports/net/unison).  This program by virtue to how it
was developed (or possibly the language is uses, that being
ocaml) uses a large amount of stack space when syncing large
directory structures.

With directory structures that contain on the order of
30,000 files, unison runs out of stack.

Using the bash shell:
ulimit reports a stack limit of 65536k:

# ulimit -a
core file size        (blocks, -c) unlimited
data seg size         (kbytes, -d) 524288
file size             (blocks, -f) unlimited
max locked memory     (kbytes, -l) unlimited
max memory size       (kbytes, -m) unlimited
open files                    (-n) 11095
pipe size          (512 bytes, -p) 1
stack size            (kbytes, -s) 65536
cpu time             (seconds, -t) unlimited
max user processes            (-u) 5547
virtual memory        (kbytes, -v) unlimited

Doing ulimit -s with a higher value does not seem to produce
an error or change to this value.

A little C++ program that I wrote to test stack limits
confirms the 64mb limit, regardless of what I tell ulimit.
Source is attached.

[-- Attachment #2 --]
#include <iostream>

using namespace std;

void r(int l)
{
  unsigned char B[1048576];
  for(int i=0; i<1048576; i++) B[i]=i%256;

  cout << l+1 << "MB on stack." << endl;
  r(l+1);

}

int main()
{
  r(0);
}


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000e01c43990$3bf36fe0$08695f0a>