High memory usage issue?

I am confused why my computer keeps hanging after a few hours. Typically, I have these open

  • Firefox, with around 10 tabs total
  • Discord in the background
  • Slack
  • Maybe a terminal and/or Dolphin file explorer

Usually, with these one it’s typically at 80-90% already. It would be nearing 95% more often if I have Discord actually open. Also, when I would have VSCode running, it would almost always get to a 100% and make my computer hang.

What makes me really confused is that when I run these same programs on Windows 10, it never hangs and reaches 100%. (Like I thought Windows is supposed to be slower). What should I do to reduce memory usage?

I have 8GB RAM, and currently no swap (just haven’t gotten around to it yet since I wasn’t given the option to make a swap partition on installing EndeavourOS for some reason).

You could run htop and check what actually takes up most RAM. Else it’s mostly guess work. I don’t use slack or discord, but never reach 8 Gb on Firefox…

Here’s a screenshot of my htop:

image

What desktop environment are you using? Bear in mind that desktop environments use a lot more ram compared to something like a window manager. For example, even a lightweight DE like xfce uses twice as much RAM at boot up compared to something like i3.

After a quick web search, I found that Discord’s ram usage is generally around 50 to 600 MB whereas Slack’s can reach as high as 1 GB.

Windows 10 is a memory hog. I know this because Windows 10 was the last OS i used before switching to Linux. And in terms of resources efficiency, Windows is nowhere near as efficient as Linux.

If you’re noticing high ram usage on Linux compared to Windows, then the culprit must be one of the applications you’re running—there could be memory leaks introduced by one of the applications you were using. If you’re using a lot of plugins on Firefox, I recommend disabling them and then check the ram usage again.

Also, please bear in mind that there has been reports by Discord users on Linux that Discord was leaking memory.

https://support.discord.com/hc/en-us/community/posts/4410300374167-When-is-the-RAM-usage-fix-coming-for-linux-

Can you also show this part as well?

2022-11-14-094719_964x222_scrot

Also, please sort the list by memory usage?

1 Like

Here’s the top part
image

I changed up my htop to make it into a tree view so it doesn’t show duplicate processes, but can’t sort it automatically by memory. The largest ones were these ones by manual inspection:
image
Everything else was about 2% big at most.

As for the desktop environment, I’m using KDE, which would be the most RAM-consuming one of them. But yeah, as I pointed out, my Windows just does fine however, so I do agree it’s most likely an application. But I don’t see how Discord, Slack, and Firefox could contribute so much when htop only shows like around 60% total at most (Slack and Discord total around 20%). Is it possible that htop could be not actually showing the true amount of memory usage for each application?

Also, I have 8 Firefox extensions, disabling all of them only decreased RAM usage by around 5-10%, I still don’t know where all the other RAM usage comes from.

Run ps_mem:

sudo pacman -Syu ps_mem

sudo ps_mem

Also:

free -h

And perhaps have a read here:

https://www.linuxatemyram.com/

1 Like

The OP mentioned that his computer hangs, though. So it could really be a sign of memory exhaustion?

Yes.
Still an informative read to get an idea what

actually mean and how memory is getting used.

1 Like

Running 10 browser tabs is going to use memory. :wink:

That usage looks pretty normal to me? Firefox and with tabs and extensions is going to eat quite a bit. I’m running about 4G Mem usage on my machine right now as well. As far as your system hanging when your Mem gets full; It doesn’t look like you have any swap space? I don’t know if you’re using a partition or a swapfile but make sure it’s mounted. Finally, you might like bpytop for montoring too.

Thank you all for your patience :smiley:

Normally, I base my RAM usage on this widget in my taskbar:
image
CPU usage on the left and RAM usage on the right. It always hangs whenever the right one reaches 99% (with the CPU usage also getting to 99%). However, the number shown here doesn’t usually correspond to what htop shows. At this screenshot^, htop says 4.10/7.57 ~ 54%.

free -h output:

               total        used        free      shared  buff/cache   available
Mem:           7.6Gi       4.0Gi       155Mi       1.4Gi       3.4Gi       1.9Gi
Swap:             0B          0B          0B

It looks like the available space does correctly correspond to the taskbar status widget, but not with htop.

sudo ps_mem output:

 58.3 MiB +   5.3 MiB =  63.6 MiB       kwin_x11 [updated]
 58.8 MiB +  13.2 MiB =  72.0 MiB       Xorg
 86.2 MiB +   9.6 MiB =  95.8 MiB       latte-dock
146.1 MiB +  10.5 MiB = 156.6 MiB       plasmashell [updated]
251.5 MiB +  45.9 MiB = 297.4 MiB       slack (7)
592.8 MiB +  98.0 MiB = 690.8 MiB       Discord (8)
  2.7 GiB + 117.7 MiB =   2.8 GiB       firefox (23)

I would keep an “steady” eye on htop while using the system normally.
See what process is causing the high CPU and RAM usage.
Could it be some file indexing, like baloo? Something else? Perhaps you’ll capture the culprit.

Also having a swap device might help avoiding Out of Memory situations. Worth considering.

Have you tried enabling your swap?
https://wiki.archlinux.org/title/swap

I mean, all you need to know is in the free -h output: no free memory and no swap.
Enable swap and you will be fine. Problem solved.

There are other, less resource-hungry DEs or WMs out there. Just saying. 8Gb of RAM isn’t much for what you’re attempting to do. I doubt, that enabling swap will solve the issue for good. Some websites, such as youtube really eat up a lot of memory and cpu-power as well, due to their heavy usage of JS and 3rd party resources. That goes for discord, too.

I agree 100% too many tabs, running discord and slack? This is something i wouldn’t ever do especially with only 8 Gb memory. I have 32GB and i still wouldn’t do it. I have never in all the years using a computer used on a regular basis multiple tabs except maybe on occasion i might have opened a couple.

1 Like

@ricklinux Agreed. The OP could switch to something like i3 for more efficient memory use if he intends to put that much load on his system without adding the amount of physical ram installed.

However, the OP did mention something that seems kind of strange to me. He said:

This doesn’t seem to fit with my own experience as a former user of Windows 7, 8.1, and 10. Even “resource hungry” distros like Ubuntu doesn’t use as much memory as Windows 10 does (nearly 2.0GB on boot up and up to 4 GB with only two browser tabs running).