1830898 Members
1830 Online
110017 Solutions
New Discussion

Increase stack size

 
Janet Sanberg
Frequent Advisor

Increase stack size

I just attemptesd to increase the stack size to 245760 on an 11.23 host by setting the maxssize kernel parameter to 251658240 but when I do a ulimit -a the stack size has not changed - is this not how do change stack size?
4 REPLIES 4
Don Morris_1
Honored Contributor

Re: Increase stack size

Yes, this is how you change stack size -- but as the man page states: "Changes to this tunable take effect only for processes started after the modification". Existing processes are unaffected -- so if you ran kctune within a shell (which is just a process), then ran the shell internal command [not a process] ulimit, you'd see the same limit for the shell as before... since it was a pre-existing process.

Any processes which are started by the shell *after* the maxssiz change, however, would see the new limit. [So you could start a new shell, then do ulimit -- or simply run a program which reports the limit such as:

#include
#include
#include

int
main(int argc, char *argv[])
{
struct rlimit save;

if ( getrlimit(RLIMIT_STACK, &save) ) {
perror("getrlimit");
exit(EXIT_FAILURE);
}

printf("Max: 0x%lx, Cur: 0x%lx.\n", save.rlim_max, save.rlim_cur);

exit(EXIT_SUCCESS);
}
Janet Sanberg
Frequent Advisor

Re: Increase stack size

Thanks that worked
Janet Sanberg
Frequent Advisor

Re: Increase stack size

closing thread
Dennis Handly
Acclaimed Contributor

Re: Increase stack size

By setting maxssiz to 251 Mb, you have just reduced the maxdsiz by that about, if you already have it at 1 Gb.
The stack is preallocated and in the same quadrant as the heap.