Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jan 2000 22:54:11 -0500
From:      "Daniel M. Eischen" <eischen@vigrid.com>
To:        Iani Brankov <ian@bulinfo.net>
Cc:        hackers@FreeBSD.ORG, Matthew Dillon <dillon@apollo.backplane.com>
Subject:   Re: The stack size for a process?
Message-ID:  <3883E3E3.9E67C83@vigrid.com>
References:  <3883AC8A.7A6F7D5F@bulinfo.net> <200001180231.SAA18439@apollo.backplane.com> <3883D4C4.E87573FC@bulinfo.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Iani Brankov wrote:
> 
> Matthew Dillon wrote:
> 
> [snip]
> 
> >     At your csh prompt type 'limit'.  If you are using bash type 'ulimit -a'.
> >
> >     When I compile and run your program it works fine on my box.  I tried
> >     compiling it -O0, -O1, and -O2.
> >
> >     % cc x.c -o x -O0
> >     % ./x
> >     %
> 
> Here's the
> 
> ~>ulimit -a
> core file size (blocks)     unlimited
> data seg size (kbytes)      524288
> file size (blocks)          unlimited
> max locked memory (kbytes)  unlimited
> max memory size (kbytes)    unlimited
> open files                  2088
> pipe size (512 bytes)       1
> stack size (kbytes)         65536
> cpu time (seconds)          unlimited
> max user processes          1043
> virtual memory (kbytes)     589824
> 
> The machine has enough RAM & swap space. (256/512MB)
> 
> I feel Daniel is right. The problem can be in the fact that it uses
> threads.
> I don't know do the threads share share the same stack space and how.
> 
> My main point was that the application worked before `making the
> world'.

The stack allocation algorithm in the threads library was fixed -
it used to leave an extra page of stack unmapped.  So you could
have been getting one more page of stack than what you are getting
now.  By default, you should get 64KB of stack per thread, and 1MB
of stack for the main thread.

Use pthread_attr_setstacksize() to specify a size larger than
the default.

Dan Eischen
eischen@vigrid.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3883E3E3.9E67C83>