How to Increase the Stack Size in Linux


The stack is a section of memory that is set aside for keeping track of all the currently active function calls within a program. It is generally set high enough that it is almost never completely used up, but some precise recursive algorithms can consume the entire stack when trying to solve a complex problem. This will cause the entire program to crash. Generally, a crash like this is a sign of an error in the program, but sometimes the only remedy is to increase the stack size through the "ulimit" option.

  • Open a terminal. This can be done in Ubuntu by clicking "Applications," "Accessories" and "Terminal." The process may differ slightly for other versions.

  • Type the following command to see the current stack size:

    ulimit -s

  • Type the following to set a new stack size:

    ulimit -s 8192

    The value should be the desired stack size in kilobytes. The above example would set a stack size of eight kilobytes.


Promoted By Zergnet


You May Also Like

  • How Much Linux Memory is Used by a Process?

    Determining the amount of memory used by a process running on a Linux platform is a tricky proposition. The values for memory...

  • What Is Irp Stack Size?

    As with setting any registry value, you should always back up your registry before performing any operation on it (for information on...

Related Searches

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!