I have a laptop with
8GB of RAM running
4.0.4-2-ARCH. Recently, I installed Android Studio, and bam, my normally pristine system was suddenly stuttering and all out freezing (more than once).
Before Android Studio, I comfortably ran SMB, Minidlna, Plex, MySQL, PostgreSQL, Apache and Chrome simultaneously with no issues. Now I struggled to run even Chrome with Android Studio. In both cases, both
free and System Monitor reported only
6.5G used RAM!
So I did a little digging and enabled a swap of
5G (swapfile). I was surprised by the performance improvement! No more lags. But still, during peak load, (Studio and Chrome) the usage was
5G RAM +
This confused me a bit and I have two questions.
Firstly, if used memory was only
6G, why the stutter and especially, why the freezes?
Secondly, my hard drive (
1TB) is about 3 years old, and I would rather keep swap disabled. Is there some other way to achieve swap-like performance, without stressing the hard drive. I have already set
swappiness to a low value of 10, which uses about
1G normally, and my laptop is already at it's maximum
I have already read these excellent answers, but I am asking this because I am not satisfied by them.
EDIT: These answers state that Linux will use all available memory and hence, for new programs, paging will slow down the computer. But if a lot the content Linux put into memory is stuff that can be managed without having done so, why is performance penalized when programs requiring large RAM are run? I mean, at best program boot up should be slow (paging).