Gennady said:
In bash, "ulimit -s" shows the current stack size in kbytes (defaults
to 8192 in Mac OS X, really low). To change it issue "ulimit -s
<kbytes>".
The command may be different for other shells. You may put this command
in /etc/profile to be set every time a user logs in.
The above command will work for BSD Unix too. I do not know how to do
it for Win2000.
Are you sure that there's no actual problem with your program? It may
really be run-away in recursion, so increasing the stack size will only
make the problem happen somewhat later.
Hm. On cygwin this happens:
10:15:30 [ContentReporter_BRANCH]: cat /c/temp/ruby/ulimit.sh
#!/bin/bash -f
ruby -e 'def t(i);p i;t(i+1);end;t(0)'
ulimit -s
<lines deleted>
13281
13282
13283
-e:1:in `p': stack level too deep (SystemStackError)
from -e:1:in `t'
from -e:1:in `t'
from -e:1:in `t'
from -e:1:in `t'
from -e:1:in `t'
from -e:1:in `t'
from -e:1:in `t'
from -e:1:in `t'
... 13274 levels...
from -e:1:in `t'
from -e:1:in `t'
from -e:1:in `t'
from -e:1
2047
This means that a stack size of approx 2MB suffices only for 13000+ stack
levels. IOW about 157 bytes per stack frame.
Unfortunately this can't be changed on cygwin:
10:16:06 [ContentReporter_BRANCH]: ulimit -s 4096
bash: ulimit: stack size: cannot modify limit: Invalid argument
10:18:19 [ContentReporter_BRANCH]: ulimit -S -s 4096
bash: ulimit: stack size: cannot modify limit: Invalid argument
10:18:23 [ContentReporter_BRANCH]: ulimit -H -s 4096
bash: ulimit: stack size: cannot modify limit: Invalid argument
I've always felt that Ruby is not too comfortable with recursion...
Cheers
robert