Desktop freezes when I have too many tabs open

Hi,

I'm sorry this is simliar to other posts. I've seen discussions about swap sizes but I don't know if it's relevant to me.
I use chrome because google workspace is so well intergrated.
Everything works well until it suddenly doesn't. It's usually when I have a lot of browser windows. I often need a lot of Quickbooks reports open at once so I can refer back and forth between them.

If I leave it for ages it sorts itself out (more than 1.5 hrs less than 4, I don't know exactly).
I'm wondering two things:

  1. how can I monitor my memory usage so that I can close some things before it freezes - can I set a warning or something?
  2. would increasing my swap help (I have an ssd)

I'm hoping that I can keep using this computer for another 6 months.

I don't remember how I installed Chrome but I think it was a deb file from the Chrome website.

Thanks so much for any help

image

Gday @Grace ,

Try disabling "Hardware acceleration" in the browser, sorry i don't know how to do this on Chrome, In settings may help

I think that may solve the issue.

Could you please load up your browser, as your would it doesn't need to freeze up, just run a few TAB's & video or photo site etc.
Then open your terminal & please post the results of this

free -h

Personally i run swappiness @ zero.
This means," Only use swap when really needed".

1 Like

Thanks Ocka,

I've turned off hardware acceleration, relaunched my browser. And then ran that command.

          total        used        free      shared  buff/cache   available

Mem: 7.7Gi 4.4Gi 906Mi 683Mi 2.4Gi 2.3Gi
Swap: 2.0Gi 255Mi 1.8Gi

2 Likes

Great, it looks about normal for about 10 or so TAB's opened.
That may have fixed the issue.
You could adjust your swap, but as you see, your using over 50% of your RAM & yet it's only needed to swap 255MiB (very little), It's wont hurt to set your swappiness to zero or 10,
If so run the following.
To edit swappiness open this file

sudo nano /etc/sysctl.conf

Then add this line to the bottom of the file,

vm.swappiness=0

set to your choice.0,10,15,20,etc

Then hold ctrl & click x
Then y to confirm the change, then click Enter

Then

reboot

After reboot if you wish to check the setting of Swappiness , use the following.

cat /proc/sys/vm/swappiness

2 Likes

Gnome may be wasting your RAM. This topic may be helpful to you.

Thank you for such a detailed reply.

I often have a lot more than 10 tabs open I usually have about 25 - I can change the way I work if I need to but it will slow me down.
I'm going to try running that free -h command again when I have them all open again tomorrow.

2 Likes

Thank you but that's a bit above my understanding level! Maybe in a few years? :laughing:

I was wondering if I should go to Zorin Light.

1 Like

i'm using ms edge browser in zorin lite, it has built in function it's name is efficiency mode that help improving power usage by saving computer recourses and sleep tabs to save recources

On SSD, it gets complicated.
Swap performs faster on SSD and Swap also creates more read/write cycles on an SSD (which is harder on the SSD). You will get lots of different opinions on this question and answer.
Recent improvements in SSD design have resulted in better read/write cycles - but I could argue that does not mean throwing caution to the wind.
The short of it is - Swap should be reserved for Emergency Only.

I use a conky to monitor my RAM usage and I run this method when I need to:

Even used AutoKey to make it quick:

1 Like

I wanted to jump in here as I've had a plethora of issues but your system specs look very close to mine, the detailed instructions I do believe have solved your immediate problems regarding the open tabs within chrome. The only other additional thing I would note is that chrome, and chromium are different, if the problem persists beyond it may be helpful to try and install chromium and test with that.

For reference regarding system specs, here are mine, and I intend on making my brick work for another few years at least :stuck_out_tongue:
Screenshot from 2023-05-05 10-29-48

of note however, I am running cinnamon and not gnome due to visual glitches. Other than an overt amount of memory I can attest my machine chugs just fine.

Best of luck :slight_smile: don't forget to mark and show love for @Ocka

3 Likes

I must be getting old.
Four cores at 3.4 GHz with 24gigs of RAM doesn't look like a brick to me.:wink:

3 Likes

u can use task manger or system monitor app , or conky,
in xfce i can use conky and i can get message notify or sound notify by using that script( in xfce my ram is 5.5):

#!/bin/bash

THRESHOLD=4000  # set the threshold to 4000 MB

while true
do
    MEM=$(free -m | awk '/Mem/ {print $3}')
    if [ "$MEM" -gt "$THRESHOLD" ]; then
        paplay /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga
        notify-send "Memory usage warning" "Memory usage is at $MEM megabytes."
    fi
    sleep 60  # check the memory usage every 60 seconds
done

i think that u need to install paplay for sound, and will work in gnome, but i think the line of notify is diffrent in gnome

*** edit:
i found that psensor app has that function too, no need to the script.
image

Another thing you can try:
chrome://settings/performance
Enable Memory Saver.

That'll dump any tabs from memory that sit idle for a long enough time, and reload the web page on that tab once you bring that tab to the forefront. That way, you can have as many tabs open as you like, and you won't exhaust your free memory.


As to swap size, give us the output of the command:
swapon --show
... as you're using your browser normally. If you've got a high number under "Used", you likely need to increase the size of the swap (which is most easily done by plugging in another USB memory stick, formatting it as swap, then setting it up to auto-mount in your fstab file... all of which we can help you with if you're exhausting your memory and swap space).


And you can try nohang:
sudo apt search nohang

nohang/focal,focal,now 0.2.0-1~oibaf~f all [installed]
  sophisticated low memory handler for Linux
sudo add-apt-repository ppa:oibaf/test
sudo apt update
sudo apt install nohang
sudo systemctl enable --now nohang-desktop.service
1 Like

image
My first computer was an Apple 2E. I stopped using commands as soon as I could though and now need to relearn and learn more after years of GUI only.

1 Like

Wow, thank you all for your generosity! This has been so helpful!

Thank you very much @Ocka. That seemed to have fixed the issue and it was so quick and couldn't have been easier! :heart: :heart: :heart: :smile:

Thanks @eid - Quickbooks doesn't work well with a lot of browsers so I'm going to try and fix it other ways before I try a new browser. I looked at both conky and psensor and found an easy tutorial for installing and configuring psensor so I went that way. It was easy!

https://linuxhint.com/install-and-configure-psensor-sensor-monitor/

Thanks @geekdad - I think 24 gb of ram would be lovely! I suppose even bricks move fast if you drop them? Good luck keeping it going.

Thanks @Aravisian for your great info, as always! Now that I have got psensor going, I'm going to try your freeing up RAM and Autokey tutorials when I have some time later.

And thanks @Mr_Magoo - I love easy suggestions (enable memory saver in chrome), but sadly it was already enabled while it was freezing.

Nohang sounds useful but I'm a bit scared off by this under warnings on Github:
"the daemon runs with super-user privileges and has full access to all private memory of all processes and sensitive user data". I'm a bookkeeper so have access to a lot of sensitive data and security is a primary concern for me.

2 Likes

Hi,

Ocka's fix to disable hardware acceleration is still working for me. I switch it on for video meetings and then off when I have to run a lot of Quickbooks reports. Now that I have Psensor, I can see that I still hit 98% CPU usage fairly frequently. It doesn't make my computer crash though - just pretty slow.

I'm wondering if that's normal or if something might be wrong?

I mostly work in chrome but I usually have Authy, Slack, and Linphone open (desktop programs). I often have one or two pdfs or images open in the normal zorin viewers. I sometimes use Skedpal and Pixie (installed chrome apps), GIMP and Libre Office but I try to only open one of these at a time and I don't use them heavily.

Thank you for any thoughts,

Grace

One thing you could try is zswap... it uses a portion of your memory as compressed swap space.

"But that'd reduce the amount of memory my applications have to use!", you may say.

Well, not so fast... zswap is compressed. So when you're low on memory, it'll swap (to memory) and compress it (generally at ~2x to ~3.6x), so you'll have more free memory and you can still access the applications at the speed of memory.

If zswap fills up, it then swaps to the hard drive just as conventional swap does (this is especially good for reducing wear on SSDs due to swapping).

So your machine with 8 GB of RAM, let's assume you use half of that for zswap. It compresses that 4 GB, and let's say it compresses at 2x... so you've now got the equivalent of 12 GB of RAM (4 GB * 2 + 4 GB). If it compresses at 3x, you've got the equivalent of 16 GB of RAM (4 GB * 3 + 4 GB).

Of course, if you're running the ZFS filesystem, you don't need zswap... the ARC is already compressed and in-memory.

Gday @Grace ,
Having the Psensor in sight can make you worry more :open_mouth: (out of sight=out of mind :slight_smile: )
This is normal when app's are started/stopped, You will see more CPU usage.
It may help to set your Swappiness to Zero.
I would also run the following to maybe clear/clean bad files/etc.
First:

sudo apt update

then post the out put on here please.

I believe you may need to also run this but wait until we look at the output of the above command

sudo apt autoremove --purge

sunlight@sunlight-HP-EliteDesk:~$ sudo apt update
[sudo] password for sunlight:            
Hit:1 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://au.archive.ubuntu.com/ubuntu focal InRelease                      
Hit:3 http://au.archive.ubuntu.com/ubuntu focal-updates InRelease              
Hit:4 http://au.archive.ubuntu.com/ubuntu focal-backports InRelease            
Hit:5 http://archive.canonical.com/ubuntu focal InRelease                      
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease               
Hit:7 http://ppa.launchpad.net/zorinos/apps/ubuntu focal InRelease             
Hit:8 https://packages.zorinos.com/stable focal InRelease                      
Hit:10 https://packages.zorinos.com/patches focal InRelease                    
Hit:11 https://packages.zorinos.com/apps focal InRelease                       
Hit:12 http://ppa.launchpad.net/zorinos/drivers/ubuntu focal InRelease
Hit:13 https://packages.zorinos.com/drivers focal InRelease                    
Hit:9 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease  
Hit:14 http://ppa.launchpad.net/zorinos/patches/ubuntu focal InRelease         
Hit:15 http://ppa.launchpad.net/zorinos/stable/ubuntu focal InRelease
Reading package lists... Done                        
Building dependency tree       
Reading state information... Done
All packages are up to date.
1 Like

Hi Ocka and Mr Magoo,

Thanks very much for your help. I posted that question late at night (for me anyway) and I completely forgot that I had posted it. I jumped on this morning to ask the question and there you were already answering me! :laughing:

The blue text above changed after I posted it. Here is a screenshot.
image

Having the Psensor in sight can make you worry more :open_mouth: (out of sight=out of mind :slight_smile: )
This is normal when app's are started/stopped, You will see more CPU usage.

That makes sense! It's exactly what I'm doing!

1 Like