Plasmashell process takes a lot of memory, stuck when I run --replace

Basically, I notice that plasmashell rapidly takes up to and more than 500MB of RAM, and I found a possible solution was to run plasmashell --replace. I tried doing this, but my terminal just froze at “Trying to make an empty dialog,” or something similar. Same thing happens when I do kstart5 plasmashell, though that also gives me an error saying I shoulv’ve included some flags. Could someone explain what might be going on here? Thank you!

You shouldn’t need to restart plasmashell, and more than 500MB of RAM is not an actual problem, unless you are very short on RAM - in which case you probably want to use a specialty “low resource” desktop instead.

On my system plasmashell takes up almost 600MB. plasmashell, kwin, kded and krunner together are basically (almost) the entire memory usage of the Plasma desktop and as long that in total they take less than 1GB, then you are running with the lightest “full experience desktop” available on Linux (not considering those specialty “low resource” desktops).

If you really really really want to restart plasmashell (but please don’t), first check if you are running a systemd setup - from the terminal run systemctl --user is-active plasma-plasmashell.service - if the response is “active”, then you are using a systemd setup.

For systemd setups, the correct way to restart plasmashell is to run systemctl --user restart plasma-plasmashell.service

For non-systemd setups, the correct way to restart plasmashell is to run: killall plasmashell && kstart plasmashell

Ah okay, as long as it isn’t necessarily a problem then all’s good! I guess I should’ve expected a more heavy desktop memory usage considering all the functionalities KDE offers, haha. In the case that memory usage goes even beyond 600MB, would it be reasonable to restart then?

To a problem you don’t have?

I should’ve expected a more heavy desktop memory usage considering all the functionalities KDE offers, haha

Haha indeed…

Stop looking at memory counters - Linux manages it well - yup - Linux - not KDE, Gnome, XFCE or whatever you are using - they just use different amounts…

Basically, I wouldn’t worry about “processes using too much memory” unless you are actually low on free RAM. For example - here’s the memory usage on my system (kind of heavily loaded with multiple browsers and development environments running at the same time):

$ free -m
               total        used        free      shared  buff/cache   available
Mem:           31758       17656        1071        2543       16036       14101
Swap:          31249       10622       20627

You might be alarmed by only 1071MB or “free” RAM, but that is a lie that the kernel tells you: I’m using about 50% of the actual RAM on the machine for actual processes and the kernel is going like - “all this free RAM is just lying around not doing anything! lets load some files that I see you’ve been using and cache them in memory” - this is the “buff/cache” part.

The “available” part is what you actually need to worry about: this is the amount of RAM that the kernel can immediately make available to running processes that need it - as long as that is comfortably high to fit in any 1 application that you may need to launch - you’re fine. If you’re launching more than 1 application, the kernel will have time to free more RAM, possibly by moving some unused application memory to the swap space.