How to Increase the Stack Size in Linux

Save

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.

References

Promoted By Zergnet

Comments

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?

    IRPStackSize represents the amount of stack locations allocated for the Input/Output Request Packet (IRP) stack in Microsoft operating systems. Modifying this value...

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

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