My friend Abhay had once told me about thread stack size configuration of Linux (Unix?) processes. This configuration specifies how much RAM is given to each thread for its stack. I ran the following command to see how much was the current stack size:
That’s 8192KB allocated for each thread. With some Googling around I figured this was a huge number. Windows allocates only 1MB by default. For a machine that’s low on RAM like mine, 8MB for stack is ludicrous. I decided to make it 2MB instead. Unsurprisingly, I wasn’t the first to try to do something like this; a thread on LinuxQuestions.org explained that I can edit
% ulimit -s 8192
/etc/security/limits.confto set the default size.
I added the following lines to my
* soft stack 2048 * hard stack 2048
rootcan modify this file; you’ll need to use
sudo.) To apply the configuration changes I restarted the machine. After restarting, now my machine is using about 1.4GB of RAM and about 80MB of swap. No need to mention, everything is fast as it used be.