I
I
Ivan2021-08-20 21:45:31
ubuntu
Ivan, 2021-08-20 21:45:31

In ubuntu, you can make some kind of notification, something like “RAM is running out”, and the use of the swap begins?

Hello. The laptop has 16 GB of RAM, which is enough. But from time to time, browsers get too fat, and so that everything does not hang tightly, you have to insure with a paging file. And for ssd it's not good for sure. I made a swap file for 4 GB, swappinessinstalled 3, so that it would not pull it once again. And now I’m actually interested, is it possible to somehow turn on some kind of notification that the RAM is almost full?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
X
xotkot, 2021-08-20
@Djonson86

And now I’m actually interested, is it possible to somehow turn on some kind of notification that the RAM is almost full?

well, what's the problem then?
to see the memory there is a free command or even directly via cat /proc/meminfo
to display notifications, you can use, for example, notify-send
to loop all this in the bash there is while
while :;do if ;then notify-send 'Палундра' "Приближается пушистый северный зверёк";fi;sleep 1;done

Here is a simple one-liner where we check every second (sleep 1) the memory using the free utility and if(if) the difference($2-$3) between total and used memory (measured in kilobytes by default) is less than 1 Gig ( $[1* 1024*1024] k) then we start sounding the alarm by displaying a message through the notify-send utility
But from time to time, browsers get too fat, and so that everything does not hang tightly, you have to insure with a paging file.

zram will save the father of Russian democracy

A
Alexander Karabanov, 2021-08-20
@karabanov

Why Linux Uses a Swap File
Why Linux Uses a Swap File, Part 2
In Defense of Swap [on Linux]: Common Misconceptions

V
Valdemar Smorman, 2021-08-21
@smorman

Why create a paging file at all???!!!
If I'm not mistaken, since 17.10 they have abandoned the mandatory creation of a SWAP partition and made it so that the system itself creates a swap file if necessary.
And considering that you have 16 GB, then I think it is not created automatically at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question