Improve memory usage in Debian

New to Debian (Or Linux in general)? Ask your questions here!
Message
Author
User avatar
PsySc0rpi0n
Posts: 262
Joined: 2012-10-24 13:54
Location: Portugal

Improve memory usage in Debian

#1 Post by PsySc0rpi0n »

Hello.

Is it possible to free memory or somehow check if is there any memory "hanging up" somewhere in my system?

I have 16Gb of memory in a laptop and I have no so called heavy programs running. I have a few programs running though, like Discord, Skype, Telegram, irssi, rtorrent Chromium (like 15 tabs open), AnyDesk, Atom (text editor) and not much more and I always have indication from htop of being using 12Gb of memory and more. Swap also shows up pretty used. Of 4.87Gb, almos 3Gbs are being used.

Isn't this too much for what I have running in my laptop? Can I check if is there anything wrong with memory usage or swap usage? What can I do to at least check if this is ok?

This is how my htop looks like:
Image

Why Chromium has that red time value? Why is it in red?

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: Improve memory usage in Debian

#2 Post by sickpig »

though u haven't confirmed but I know u r using gnome
solution
dont

User avatar
PsySc0rpi0n
Posts: 262
Joined: 2012-10-24 13:54
Location: Portugal

Re: Improve memory usage in Debian

#3 Post by PsySc0rpi0n »

sickpig wrote:though u haven't confirmed but I know u r using gnome
solution
dont
It's not Gnome. It's Plasma Desktop!

Which lighter Desktop you recommend? I don't want the simplest and most memory light desktop. I just want one that can bare with my laptop. I know a few like LXDE, XFCE but maybe those are too simple?

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: Improve memory usage in Debian

#4 Post by sickpig »

plasma is evil twin of gnome :)
try lxde and experience how responsive your system becomes
and geez 15 open tabs? y? thats just inefficient way of working(sorry for being rude)
try a tab suspender or some extension
the best way is to change your workflow and not open a so many tabs
i cant imagine a scenario wherein anything could be productive with so many tabs open
also remove any superfluous browser extensions which you might have

User avatar
PsySc0rpi0n
Posts: 262
Joined: 2012-10-24 13:54
Location: Portugal

Re: Improve memory usage in Debian

#5 Post by PsySc0rpi0n »

sickpig wrote:plasma is evil twin of gnome :)
try lxde and experience how responsive your system becomes
and geez 15 open tabs? y? thats just inefficient way of working(sorry for being rude)
try a tab suspender or some extension
the best way is to change your workflow and not open a so many tabs
i cant imagine a scenario wherein anything could be productive with so many tabs open
also remove any superfluous browser extensions which you might have
The 15 tabs is just to avoid be opening them every time I need to read something from there. I have just a couple of extensions. Not many. Or maybe I have some. But I feel I need them all. At least 18 add-ons.

Anyway, what about the red time of my htop for Chromium? And also what means that column called 'S' between 'SHR' and CPU%?

andre@home
Posts: 398
Joined: 2011-10-02 08:00

Re: Improve memory usage in Debian

#6 Post by andre@home »

sickpig wrote:the best way is to change your workflow and not open a so many tabs
i cant imagine a scenario wherein anything could be productive with so many tabs open
I've a multiple amount of tabs of that 15....
Sometimes make a backup of them to a spreadsheet.
When you are working... on several things.. it is not very handy to be limited to very little amount of tabs...
So your perfect workflow does not need to be mine....
I mostly use Opera for that under Debian 8 & Windows...
So far never had a problem with so many tabs open, most problems are coming from other programs (under Windows the virusscanner..... ;) ).

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: Improve memory usage in Debian

#7 Post by sickpig »

andre@home wrote:[I've a multiple amount of tabs of that 15....
Sometimes make a backup of them to a spreadsheet.
When you are working... on several things.. it is not very handy to be limited to very little amount of tabs...
So your perfect workflow does not need to be mine....
Excellent more power to u
open as many as u can thats the way. hope u can still c the title of the webpape on that tab amongst more than 15 of yours though :lol:

andre@home
Posts: 398
Joined: 2011-10-02 08:00

Re: Improve memory usage in Debian

#8 Post by andre@home »

off topic;
Opera has a search engine for the tabs... 8) :lol:
Very handy... 8)
Time to go to school again.... :mrgreen: :lol:

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: Improve memory usage in Debian

#9 Post by sickpig »

PsySc0rpi0n wrote:[18 add-ons.
really!? :!:
u know each of those addons consumes RAM right? atleast 100mb probably each, thats ur 2 Gig right there

sorry i dont use either htop or chromium so i have no clue about below
PsySc0rpi0n wrote:[Anyway, what about the red time of my htop for Chromium? And also what means that column called 'S' between 'SHR' and CPU%?

User avatar
Head_on_a_Stick
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Improve memory usage in Debian

#10 Post by Head_on_a_Stick »

@OP: please post the output of

Code: Select all

free -h
It would also help to see what ps_mem says about individual programs' memory consumption:

Code: Select all

git clone https://github.com/pixelb/ps_mem && cd ps_mem
sudo ./ps_mem.py # or: su -c './ps_mem.py'
Here are my outputs for reference:

Code: Select all

E485:~$ free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       544Mi        14Gi        52Mi       662Mi        14Gi
Swap:         4.0Gi          0B       4.0Gi
E485:~$ sudo ps-mem
 Private  +   Shared  =  RAM used       Program

220.0 KiB +  51.5 KiB = 271.5 KiB       startx
280.0 KiB + 151.5 KiB = 431.5 KiB       xinit
300.0 KiB + 153.5 KiB = 453.5 KiB       slstatus
312.0 KiB + 181.5 KiB = 493.5 KiB       cron
580.0 KiB + 147.5 KiB = 727.5 KiB       alsactl
904.0 KiB + 259.5 KiB =   1.1 MiB       login
748.0 KiB + 589.5 KiB =   1.3 MiB       loksh (3)
  1.0 MiB + 324.5 KiB =   1.3 MiB       sudo
960.0 KiB + 765.5 KiB =   1.7 MiB       dwm
  1.0 MiB + 860.5 KiB =   1.8 MiB       systemd-timesyncd
  1.0 MiB + 948.0 KiB =   1.9 MiB       dbus-daemon (2)
  1.2 MiB + 790.5 KiB =   2.0 MiB       systemd-logind
  1.0 MiB +   1.6 MiB =   2.6 MiB       systemd-udevd (2)
  2.4 MiB + 793.5 KiB =   3.2 MiB       systemd-journald
  3.3 MiB +  50.5 KiB =   3.4 MiB       wpa_supplicant
  3.1 MiB +   4.5 MiB =   7.6 MiB       systemd (3)
 12.4 MiB +   3.1 MiB =  15.6 MiB       xterm (2)
 41.9 MiB +  20.8 MiB =  62.7 MiB       Xorg
346.4 MiB +  99.7 MiB = 446.1 MiB       firefox-esr (3)
---------------------------------
                        554.7 MiB
=================================
E485:~$
I have 10 tabs open in FF.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support

arochester
Global Moderator
Global Moderator
Posts: 2017
Joined: 2010-12-07 19:55
Has thanked: 1 time
Been thanked: 2 times

Re: Improve memory usage in Debian

#11 Post by arochester »

It might be 'buntu but there is some useful information here https://askubuntu.com/questions/2194/ho ... erformance

Do you have a HDD or a SDD?

Do you need all the tabs all the time? Or, could you put them in a folder, open all and close them as you finish with them?

Do you autostart programs? Do you need to?

Wheelerof4te
Posts: 1454
Joined: 2015-08-30 20:14

Re: Improve memory usage in Debian

#12 Post by Wheelerof4te »

PsySc0rpi0n wrote:I have no so called heavy programs running. I have a few programs running though, like Discord, Skype, Telegram, irssi, rtorrent Chromium (like 15 tabs open), AnyDesk, Atom
That is a pretty hefty list of heavy-hitters, especially if you are running all of them at once.
You could reduce swappiness, at least that is what I would advise you to do. You need only about 15, the default is 60, which is way too high.

Code: Select all

nano /etc/sysctl.conf
Place vm.swappiness=15 at the end of that file. Save and reboot. This way, your system will prefer more RAM over swapping every time you hit 40% of your max RAM.

Also, ignore sickpig and everyone else who keeps bragging about their DE/WM choices. I am running GNOME, which is considered heavier than Plasma, and I'm not having much problems on a entry to mid level laptop. Your problem lies elsewhere. Try to reduce the amount of autostarted applications. Use recent versions of Chromium, the ones in Stretch and Buster are outdated. Or switch to Firefox for a while and test.

If you are still on Stretch, it would be beneficial to upgrade to Buster, as Plasma 5.14 is much faster and lighter than 5.8 in Stretch.

CwF
Posts: 1124
Joined: 2018-06-20 15:16
Has thanked: 1 time
Been thanked: 4 times

Re: Improve memory usage in Debian

#13 Post by CwF »

I guess it depends on how we do things, huh. My current tally arranged in my way suggest window and tab count don't tell the whole story. Currently, 105 tabs and 24 windows, 18968 MB ram, 580 MB swap. 34 days up. No issue.

andre@home
Posts: 398
Joined: 2011-10-02 08:00

Re: Improve memory usage in Debian

#14 Post by andre@home »

I have the same experience.

User avatar
PsySc0rpi0n
Posts: 262
Joined: 2012-10-24 13:54
Location: Portugal

Improve memory usage in Debian

#15 Post by PsySc0rpi0n »

Jeeezzz. From what I read of other's experiences, I should have no problems. I'm not at the PC but I'll try to run those commands to see what I get. I know that Chromium is most likely the coolprit. I closed all applications but Chromium and RAM went down to about 8Gb and swap just slightly decreased.

Sent from my SM-G935F using Tapatalk

User avatar
PsySc0rpi0n
Posts: 262
Joined: 2012-10-24 13:54
Location: Portugal

Re: Improve memory usage in Debian

#16 Post by PsySc0rpi0n »

Ok, I removed 6 addons I probably can leave without. I have closed a few Chromium tabs and closed Atom, Skype, Dropbox (icon next to the clock), Hangouts (icon next to the clock).

Now things looks a lot better.

Here it goes:

Code: Select all

free -h
              total        used        free      shared  buff/cache   available
Mem:            15G        3,5G        7,9G        227M        4,2G         11G
Swap:          4,9G        747M        4,1G
su -c './ps_mem.py'
Password:
Private + Shared = RAM used Program

4.0 KiB + 4.5 KiB = 8.5 KiB uuidd
4.0 KiB + 4.5 KiB = 8.5 KiB startkde
4.0 KiB + 4.5 KiB = 8.5 KiB agetty
4.0 KiB + 8.5 KiB = 12.5 KiB dbus-launch [updated]
4.0 KiB + 9.5 KiB = 13.5 KiB sshd
4.0 KiB + 10.5 KiB = 14.5 KiB dirmngr
8.0 KiB + 8.5 KiB = 16.5 KiB ksysguardd
4.0 KiB + 13.5 KiB = 17.5 KiB obexd
4.0 KiB + 13.5 KiB = 17.5 KiB ck-launch-session
4.0 KiB + 17.5 KiB = 21.5 KiB kwrapper5
4.0 KiB + 21.5 KiB = 25.5 KiB gconf-helper
8.0 KiB + 30.0 KiB = 38.0 KiB dconf-service (2)
44.0 KiB + 2.5 KiB = 46.5 KiB start_kdeinit
40.0 KiB + 8.5 KiB = 48.5 KiB rtkit-daemon
48.0 KiB + 5.5 KiB = 53.5 KiB atd
36.0 KiB + 27.5 KiB = 63.5 KiB sddm-helper
68.0 KiB + 2.5 KiB = 70.5 KiB ssh-agent
4.0 KiB + 75.5 KiB = 79.5 KiB virtlogd
80.0 KiB + 7.5 KiB = 87.5 KiB gpg-agent
116.0 KiB + 7.5 KiB = 123.5 KiB memcached
124.0 KiB + 5.5 KiB = 129.5 KiB cron
128.0 KiB + 7.5 KiB = 135.5 KiB dbus-monitor [updated]
128.0 KiB + 19.5 KiB = 147.5 KiB gconfd-2
148.0 KiB + 15.5 KiB = 163.5 KiB gvfsd-fuse
164.0 KiB + 7.5 KiB = 171.5 KiB irqbalance
176.0 KiB + 4.5 KiB = 180.5 KiB polipo
188.0 KiB + 6.5 KiB = 194.5 KiB lvmetad
252.0 KiB + 5.5 KiB = 257.5 KiB proftpd
232.0 KiB + 58.5 KiB = 290.5 KiB chrome-sandbox
304.0 KiB + 10.5 KiB = 314.5 KiB rpcbind
324.0 KiB + 7.5 KiB = 331.5 KiB acpid
192.0 KiB + 202.5 KiB = 394.5 KiB dnsmasq (3)
376.0 KiB + 20.5 KiB = 396.5 KiB at-spi2-registryd
404.0 KiB + 43.5 KiB = 447.5 KiB at-spi-bus-launcher
412.0 KiB + 47.5 KiB = 459.5 KiB sddm
420.0 KiB + 59.5 KiB = 479.5 KiB accounts-daemon
500.0 KiB + 5.5 KiB = 505.5 KiB exim4
392.0 KiB + 136.5 KiB = 528.5 KiB gvfsd
540.0 KiB + 6.5 KiB = 546.5 KiB smartd
532.0 KiB + 67.0 KiB = 599.0 KiB avahi-daemon (2)
668.0 KiB + 35.5 KiB = 703.5 KiB ntpd
448.0 KiB + 264.5 KiB = 712.5 KiB systemd-logind
680.0 KiB + 64.5 KiB = 744.5 KiB ModemManager
748.0 KiB + 7.5 KiB = 755.5 KiB rsyslogd
700.0 KiB + 77.5 KiB = 777.5 KiB kaccess
812.0 KiB + 76.5 KiB = 888.5 KiB upowerd
920.0 KiB + 7.5 KiB = 927.5 KiB dhclient
980.0 KiB + 18.5 KiB = 998.5 KiB bluetoothd
960.0 KiB + 74.5 KiB = 1.0 MiB kscreen_backend_launcher
952.0 KiB + 96.5 KiB = 1.0 MiB console-kit-daemon
1.0 MiB + 108.5 KiB = 1.1 MiB xterm
1.2 MiB + 4.5 KiB = 1.2 MiB mount.ntfs-3g
1.2 MiB + 64.5 KiB = 1.2 MiB wpa_supplicant
904.0 KiB + 374.5 KiB = 1.2 MiB gvfsd-trash
1.2 MiB + 100.5 KiB = 1.3 MiB kiod5
1.3 MiB + 80.5 KiB = 1.4 MiB akonadi_control
1.1 MiB + 257.5 KiB = 1.4 MiB su
1.4 MiB + 86.5 KiB = 1.4 MiB akonadi_migration_agent
1.3 MiB + 160.5 KiB = 1.5 MiB colord
1.4 MiB + 86.5 KiB = 1.5 MiB akonadi_contacts_resource
1.2 MiB + 350.5 KiB = 1.6 MiB cups-browsed
1.5 MiB + 98.5 KiB = 1.6 MiB akonadi_akonotes_resource
1.5 MiB + 149.5 KiB = 1.6 MiB cupsd
1.5 MiB + 104.5 KiB = 1.6 MiB akonadi_maildir_resource
1.5 MiB + 254.5 KiB = 1.7 MiB xembedsniproxy
1.7 MiB + 8.5 KiB = 1.7 MiB systemd-udevd
1.7 MiB + 103.5 KiB = 1.8 MiB akonadi_newmailnotifier_agent
1.7 MiB + 185.0 KiB = 1.9 MiB screen (2)
1.3 MiB + 687.5 KiB = 2.0 MiB klauncher
1.9 MiB + 132.5 KiB = 2.1 MiB kdeconnectd
1.9 MiB + 142.5 KiB = 2.1 MiB akonadi_ical_resource
1.6 MiB + 523.0 KiB = 2.1 MiB python3.5 (2)
1.8 MiB + 233.5 KiB = 2.1 MiB kuiserver5
2.0 MiB + 131.5 KiB = 2.1 MiB akonadi_maildispatcher_agent
2.1 MiB + 105.5 KiB = 2.2 MiB akonadi_mailfilter_agent
1.9 MiB + 370.5 KiB = 2.3 MiB kwalletd5
2.2 MiB + 151.5 KiB = 2.4 MiB korgac
2.1 MiB + 342.5 KiB = 2.4 MiB akonadi_followupreminder_agent
2.2 MiB + 203.5 KiB = 2.4 MiB htop
2.3 MiB + 158.5 KiB = 2.4 MiB systemd-journald
2.0 MiB + 438.5 KiB = 2.4 MiB gvfs-udisks2-volume-monitor
2.3 MiB + 172.5 KiB = 2.5 MiB akonadi_notes_agent
2.5 MiB + 36.5 KiB = 2.6 MiB perl
2.4 MiB + 177.5 KiB = 2.6 MiB akonadi_archivemail_agent
2.3 MiB + 298.5 KiB = 2.6 MiB udisksd
2.7 MiB + 138.5 KiB = 2.9 MiB polkitd
3.2 MiB + 91.5 KiB = 3.2 MiB vim.gtk [updated]
3.1 MiB + 123.5 KiB = 3.3 MiB kglobalaccel5
3.3 MiB + 54.5 KiB = 3.3 MiB libvirtd
3.6 MiB + 94.5 KiB = 3.7 MiB akonadi_birthdays_resource
3.6 MiB + 94.5 KiB = 3.7 MiB akonadi_indexing_agent
2.5 MiB + 1.3 MiB = 3.8 MiB systemd (3)
3.3 MiB + 600.5 KiB = 3.8 MiB kactivitymanagerd
3.8 MiB + 0.5 KiB = 3.8 MiB teamviewerd
2.9 MiB + 1.2 MiB = 4.1 MiB kded4
4.0 MiB + 256.5 KiB = 4.3 MiB polkit-kde-authentication-agent-1
2.8 MiB + 1.7 MiB = 4.5 MiB kdeinit4 (2)
4.5 MiB + 108.5 KiB = 4.6 MiB tracker-store
4.5 MiB + 462.5 KiB = 5.0 MiB hp-systray
4.8 MiB + 365.5 KiB = 5.2 MiB akonadi_sendlater_agent
5.1 MiB + 267.5 KiB = 5.4 MiB freshclam
5.3 MiB + 70.0 KiB = 5.4 MiB gnome-keyring-daemon (2)
5.1 MiB + 389.0 KiB = 5.5 MiB dbus-daemon [updated] (4)
5.7 MiB + 1.0 MiB = 6.7 MiB bash (5)
5.3 MiB + 1.5 MiB = 6.8 MiB pulseaudio
7.6 MiB + 883.5 KiB = 8.4 MiB org_kde_powerdevil
8.4 MiB + 551.5 KiB = 9.0 MiB krunner
9.5 MiB + 138.5 KiB = 9.6 MiB NetworkManager
9.5 MiB + 326.5 KiB = 9.8 MiB MusicManager
12.8 MiB + 642.5 KiB = 13.4 MiB ksmserver
12.6 MiB + 915.5 KiB = 13.5 MiB rtorrent main
12.7 MiB + 1.9 MiB = 14.6 MiB kdeinit5 (2)
16.9 MiB + 71.5 KiB = 17.0 MiB akonadiserver
9.6 MiB + 7.9 MiB = 17.5 MiB apache2 (6)
19.3 MiB + 125.5 KiB = 19.4 MiB irssi
26.0 MiB + 16.5 KiB = 26.0 MiB prx
37.6 MiB + 252.5 KiB = 37.8 MiB packagekitd
39.0 MiB + 2.2 MiB = 41.3 MiB kwin_x11
45.7 MiB + 911.0 KiB = 46.6 MiB mysqld (2)
49.8 MiB + 6.8 MiB = 56.6 MiB konsole
95.1 MiB + 11.5 MiB = 106.6 MiB telegram-desktop
156.5 MiB + 3.7 MiB = 160.2 MiB Xorg
272.6 MiB + 7.3 MiB = 279.8 MiB plasmashell
2.3 GiB + 143.6 MiB = 2.4 GiB chromium (28)
---------------------------------
3.4 GiB
=================================

Someone asked about if I have an SDD or HDD.
Where Debian is running is an SDD.

Any programs that are starting at boot is because they self-configured to autostart when they were installed.
I'll try that trick about sysctl.conf. I'm in Stretch. Is Buster already stated as stable? Or testing?

theblueplll
Posts: 154
Joined: 2019-04-29 01:17

Re: Improve memory usage in Debian

#17 Post by theblueplll »

sickpig wrote:plasma is evil twin of gnome :)
Not sure where you get this from.

Gnome on my machine uses over 1gb of ram on startup and never lets go of ram when I close programs

KDE uses 350mb
One thing that helps KDE is to not install all the bloat but even when I had all that it used very little ram.

So the op has something going on or expects to have way too much running all at once.

LXDE is ok if you want your machine too look like it is 2002.

guess it depends on how we do things, huh. My current tally arranged in my way suggest window and tab count don't tell the whole story. Currently, 105 tabs and 24 windows, 18968 MB ram, 580 MB swap. 34 days up. No issue.
WOW
What are you running for hardware I want it? LoL

andre@home
Posts: 398
Joined: 2011-10-02 08:00

Re: Improve memory usage in Debian

#18 Post by andre@home »

Try Opera and compare the numbers/behavior and report back.
Why? Read this:
https://www.reddit.com/r/operabrowser/c ... om_chrome/

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: Improve memory usage in Debian

#19 Post by sickpig »

opera is also chromium based the RAM usage wouldn't differ much
Also, if you are browsing resource intensive websites like microsoft teams then RAM is going to deplete fast. It uses around 500 mb in chrome for just that one tab!!
Depends what 15 tabs are opened by OP, if they are as RAM magnets as teams then there goes half of his RAM.

@OP I am glad removing addons helped your cause

@theblueplll couldn't agree more, kde is definitely better than gnome but still heavy nonetheless. All the bling is going to spike RAM usage for sure.

@OP if you want to painlessly cut down on autostart apps then i have just the right app for it. let me know if you want to.

Also, ignore Wheelerof4te who keeps bragging about gnome, unlesss you want to try it. Expect more than double RAM usage on it though :)

Edit: from your apps Atom is electron based. Electron apps are notorious for abusing RAM usage as they are chromium based. If possible try to find alternative which is non electron based.

andre@home
Posts: 398
Joined: 2011-10-02 08:00

Re: Improve memory usage in Debian

#20 Post by andre@home »

Do not have Chromium on my system and yet I'm on another OS, 117 tabs of Opera use only 22 MB per tab, sums up to 2.7 GB of RAM in use (from 16 GB).
So 22 MB per tab is >>20x less RAM user per tab than under Chromium? Hmmm. Can't imagine it will be so OS-dependent. So: Need to retest this under Debian.

Post Reply