Re: stack size
On Tue, Apr 22, 2008 at 11:57:35PM -0700, Francesco Pietra wrote:
>
> On increasing the size of the molecule treated, the procedure immediately crashed with error message
>
> what (): St9bad_alloc
>
> Failure of the () operator was attributed by the program developers to memory exhausion (UMA system, 4 dual-opteron 875, ecc 24GB, of which 1 for debian amd64 etch, set with shmmax). On request I showed
>
> ulimit -a
>
> core file size (blocks, -c) 0
> data seg size (kbytes, -d) unlimited
> max nice (-e) 0
> file size (blocks, -f) unlimited
> pending signals (-i) unlimited
> max locked memory (kbytes, -l) unlimited
> max memory size (kbytes, -m) unlimited
> open files (-n) 1024
> pipe size (512 bytes, -p) 8
> POSIX message queues (bytes, -q) unlimited
> max rt priority (-r) 0
> stack size (kbytes, -s) 8192
> cpu time (seconds, -t) unlimited
> max user processes (-u) unlimited
> virtual memory (kbytes, -v) unlimited
> file locks (-x) unlimited
>
> The comment was: The item that is suspiciously small is the stack size. Did you try to set it to unlimited?
>
> I did, with
>
> ulimit -s unlimited
>
> though, () failure was not solved. I am still investigating the issue.
>
> >From that, I extrapolated (now clearly wrongly) that setting stack size to unlimited may be beneficial to have all available memory used in memory-demanding computation.
Well the stack is only used for passing arguments to functions and for
local variables in a function. Most large chunks of data are allocated
using malloc which means it comes from the heap, not the stack.
It takes a rather badly designed program to use 8MB of stack space.
--
Len Sorensen
Reply to: