1

I have 8GB RAM, and use my PC (Debian 10, KDE plasma 5.14.5) "normally" but with many programs running in parallel:

  • Firefox (≈ 250 Tabs)
  • Chromium (10 Tabs)
  • Thunderbird
  • 10x Okular
  • 2x Pycharm
  • 5x Konsole
  • Dolphin
  • Kile
  • Element, Telegram, Wikidpad, ...

After a fresh restart RAM consumption of my system is at about 4GB. Everything runs smoothly and fast. After several days (with suspend over night) RAM consumption is at about 7.5GB and it takes e.g. 10s to switch from Firefox to Dolphin.

I already tried (source)

# echo 1 > /proc/sys/vm/drop_caches
# echo 2 > /proc/sys/vm/drop_caches
# echo 3 > /proc/sys/vm/drop_caches

but it had no significant effect.

This is the output of free -m:

              total        used        free      shared  buff/cache   available
Mem:           7754        5163         950         588        1641        1708
Swap:         19071         704       18367

swapon -s gives:

Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       19529724        720896  -2

Question: How can I "clean" the RAM to get back the situation after restart (+ automatic program launches) but without doing an actual restart?

Disclaimer: This question got some comments on askubuntu.com/... but was regarded as offtopic for that site.

cknoll
  • 130
  • 1
    You don't ask a question. If you want to know how to reduce RAM usage, the answer is simple: Stop a process that consumes a lot of RAM. On a PC, where you are the only user and in full control, this should not be hard. top helps you find out which processes are big consumers. Trying to influence swap behaviour won't change anything to the fact that your applications consume too much. – berndbausch Mar 04 '21 at 10:13
  • @berndbausch Yes, stopping processes is an obvious solution but not the kind I am looking for. I have reasons to keep these processes running and it works quite well for many hours after a restart. But over the time the system gets slower without running more and more processes – usage conditions remain the same but performace drops... Should I rephrase my question to make this more clear? – cknoll Mar 04 '21 at 10:44
  • 1
    I would say, ask a question in the first place :) – berndbausch Mar 04 '21 at 11:10
  • As @berndbausch says: top is your friend. Press 'm' to sort by memory usage. – Ole Tange Mar 08 '21 at 10:44

2 Answers2

1

I experience that Firefox increases memory usage over time. But Firefox is reasonably good at restoring a tab.

I have made https://gitlab.com/ole.tange/tangetools/-/tree/master/fxkill to kill off tabs without closing them.

After running fxkill it will kill all tabs, and you then restore the individual tabs when you need them.

Ole Tange
  • 35,514
0

You don't have enough RAM for your tasks and the slowness can be explained by heavy swapping, i.e. the kernel pushes your running applications to swap and then fetches them from swap when you're switching between them. Dropping caches will only exacerbate the whole situation.

It's hard to suggest anything in this situation.

I want to hope that your disk storage is not SSD because heavy swapping could severely shorten its lifespan.

  • Thanks for the answer, but I do not think that it is merely a problem of too few RAM. Because everything works fine for some hours but the performance loss builds up only over time (at least three days (2 times suspend to ram)).

    Anyway, thanks for the warning regarding the SSD (yes my HD is an SSD)

    – cknoll Mar 04 '21 at 11:12
  • 3
    Web browsers tend to leak RAM over time. Restarting them should probably fix your issue. Plasma and kwin also leak RAM. You could restart them as well. – Artem S. Tashkinov Mar 04 '21 at 11:17