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:
% ulimit -s
8192That’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 /etc/security/limits.conf to set the default size.I added the following lines to my
/etc/security/limits.conf:* soft stack 2048
* hard stack 2048(Only root can 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.