My laptop: 4gb Ram, CPU Intel Core i5 6200. os: Ubuntu 18.04.2 LTS. I have a problem with ram usage excessive. When i close app, ram no change. so my laptop lag and run so slow. You can help me?
It's no surprise that Gnome3 uses a lot of memory but 4gb should be enough for day to day usage and apps, although saying that, you could easily change your distro to Kubuntu, Xubuntu or even Lubuntu as each use far less memory.
Open a terminal and run the
swapon command. If you don't see any swap spaces listed, then run the following command:
sudo apt install zram-config
That will enable ZRAM swap space, which is better than nothing.
If do you have a swapspace listed and you do not see /dev/zram0 listed then you can try enabling ZSWAP to create a compressed swap cache to speed up swap performance.
At the terminal, run
find the line with
GRUB_CMDLINE_LINUX_DEFAULT=quiet splash and amend as follows:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash zswap.enabled=1 zswap.compressor=lz4 zswap.max_pool_percent=25 zswap.zpool=z3fold"
Save the changes
sudo update-grub then reboot to apply the changes.
This will use up to 25% of your system memory as compressed swap cache, with typically 2.7:1 compression ratio. So if you have 4G of RAM it will use 1G of memory to create a 2.7GB swap cache, which will make your system feel similar to how it would with 5.7GB of RAM, under ideal circumstances. If you have an SSD it will also reduce the amount of writes to the swap space by a significant amount.
Having said all of this, consider the value of adding RAM or faster storage. If you work from home and you can make a $600 laptop run more than twice as fast for your workload by spending $28 on a 4G UDIMM, or $55 on a 256G SSD, then you will increase your productivity enough to pay for that storage in under a month. I have an Asus UX310UA with 6200U/1TBHDD/8GRAM and adding an M.2 SSD turned this thing from a slouch that felt it needed replacing ASAP into a rocket that will last another 4-5 years. Also your battery life will increase if the OS can put the storage to sleep - it can't do that when you're swapping.
Unfortunately, 4gb ram is not enough for a smooth experience on
18.04. I'd suggest you downgrade to
16.04 or move to other distro with lesser footprint.
There are some tricks you can try before (disabling services, removing startup and background apps)
See those two articles below (with some grain of salt)
Disabling background processes (caution: for advanced users, don't disable anything unless you're absolutely sure what it does.)
lobotomizing gnome (caution: might break your system, not suggessted if you're not an advanced user)
Additionally you can try using Zram (
sudo apt install zram-config) to make expand your existing ram size.
You can get about 400-600mb back from those steps mentioned, and
zram will compress your data and store as sawp so you won't run out of memory soon. But the moment you start a browser with 15 or more tabs, you'll feel it's time to upgrade your hardware.