I need to increase the default stack size on Linux. As I know there are usually two ways:

  • ulimit -s size
  • /etc/security/limits.conf

The ulimit method only works as long as I am logged in.

limits.conf will work after a restart.

Is there a possible way to increase the limit without restarting?

migrated from stackoverflow.com Jul 21 '11 at 1:47

This question came from our site for professional and enthusiast programmers.

  • There must be a way to do this. The ulimit shell command doesn't work for a user. And the current logged in user doesn't have permission to alter their limit unless they are root. – Matt H Dec 21 '12 at 1:45

What's wrong with editing your .bashrc file to do a ulimit -s size every time you start a terminal session?

  • unfortunately that is not for me as a user, it is for the couchdb process, which crashes because a document in the DB is to big to fit in the stack. – Simon Jul 21 '11 at 11:17
  • @Simon: that means you're currently restarting that process every time? How is that done? Can't you splice the ulimit -s size in the scripts that control the restarts? – MSalters Jul 21 '11 at 12:48
  • well, it is a subprocess of couchdb that crashes (couchjs). So all processes started by the user couchdb should have a bigger stack – Simon Jul 21 '11 at 13:07

If you want to do this programatically, you can use the setrlimit() function.

  • unfortunately I need to set the limit for couchdb, not for a program of my own. So setting it programatically is out of question – Simon Jul 21 '11 at 11:17

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.