4

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?

4
  • 1
    Possibly closing the app GUI doesn't kill the process itself. Something similar to what skype does. Have you tried starting the app from cli?
    – bistoco
    Apr 17, 2019 at 2:25
  • 1
    Ubuntu also caches applications in RAM and only frees them when another app needs the space. See: askubuntu.com/questions/743649/… & askubuntu.com/questions/184217/…
    – oldfred
    Apr 17, 2019 at 2:48
  • I think you should change the problem description to say you're experiencing slow-downs because you don't have enough RAM and you'd like to know if you can solve this in software instead of upgrading your laptop's RAM. That way this question will remain relevant when average users have 8G or more, and you won't get unhelpful answers like "4G isn't enough - upgrade your memory or use a different distro release".
    – Wil
    May 16, 2019 at 0:38

3 Answers 3

8

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 sudoedit /etc/default/grub

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

run 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.

0
2

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.

1

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.

5
  • I trying Gnome on Xorg Desktop on Ubuntu 18.04. And I feel great. Apr 17, 2019 at 4:11
  • 1
    @NguyễnĐìnhTrường the OS works perfectly when there's enough resource available. The problem occurs when we don't have enough resource. I had 4gb ram on my laptop 3 months ago, got too frustrated with the workflow, and bought a new ram on tet holiday. Now my workflow is perfect. Apr 17, 2019 at 4:16
  • 1
    @SirajusSalekin Please remove "reducing ubuntu memory usage": it is a poor article recommending to delete files in your system folders to disable certain services, instead of recommending proper approaches for disabling services at startup. It will likely break people's systems.
    – vanadium
    Apr 17, 2019 at 8:50
  • @vanadium I agree the articles are poorly written, unfortunately those are the only way I could lower my memory consumption. So, I'll keep them there just for the sake of not finding a better solution. But I have added caution notes to fend off novice users from trying. thanks. Apr 17, 2019 at 9:01
  • tbh, i think it's way better to just use gnome-tweaks to disable those extensions, hmm. I'll remove the link. Apr 17, 2019 at 9:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .