CSGO lagging and freezes

In Stem Preferences, are you using Proton Experimental?
Do you have Vulkan Shading enabled?
I notice you do not show any Nvidia...

Might be free RAM... it specifies 4 GB total RAM, you've got 3816 MB.

While you're running CSGO, can you open a Terminal window and enter the following:
free
... then post the results.

1 Like

Proton experimental - no
Vulkan- dont know, maybe yes cuz it showz something like that during startup .
no, no nvdia

         total        used        free      shared  buff/cache   available

Mem: 3907712 -2621804- 120372 -535224- 1165536- 509180
Swap: 2097148 -2096952 -196

It's using your swap heavily, so I'd say you're short on memory. The lags are likely when it's using the swap. I'd suggest getting more RAM. I'd further suggest getting a USB stick, plugging it in, and setting it up as a second swap drive. I'd further suggest you install 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

I know nowadays that the common knowledge is that no swap is needed, or only a 2 GB swap is needed... I still stick to 2x RAM as a minimum. I have 4x, across two drives.

free
              total        used        free      shared  buff/cache   available
Mem:       11585624     5396996     5439080       47168      749548     5819332
Swap:      50331640           0    50331640

This will increase the speed of the swap a bit:

What does this swap drive do in linux, and this kind of freezing problem I have only seen in linux cuz apps which are built for linux , while using them when high memory usage occurs it freezes but that kind of thing didnt happen in windows.

The swap functionality in Linux is the same as it is in Windows... when free RAM is low, it swaps out the bits of data that are least-used to the hard drive, to free up RAM for more-recently-used bits.

But if that data on the swap is needed, it must be swapped back into memory, and other bits swapped out. Hence the lag, since hard drives are orders of magnitude slower than RAM.

But while in csgo i saw that the ram memory wasnt even full.
was staying at something like 80%

The swap functionality must keep at least some free RAM, otherwise the system will panic and start killing applications, so it starts swapping when free RAM gets low, and attempts to keep a little free RAM.

You're riding right on the ragged edge, since your memory is low, and your swap is nearly entirely used. If you start up more applications, you'll likely experience the OS shutting down applications to free up memory.

username:~$ sudo apt search nohang
Sorting... Done
Full Text Search... Done
username:~$ sudo apt install nohang
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package nohang

This is happening while installing nohang

sudo add-apt-repository ppa:oibaf/test
sudo apt update
sudo apt install nohang
sudo systemctl enable --now nohang-desktop.service

will only installing nohang solve the problem or i need to do that more swap location thingy with a usb stick

The very first thing I would suggest is installing nohang... at least when the OS starts killing applications, it'll do so gracefully, rather than just crashing them or itself.

The second thing I would suggest is to install more RAM, max out the machine's RAM capabilities, if you can afford to do so.

The third thing I would suggest is to set up another swap drive. Try to get the latest USB 3.2 or whatever it is now, so it's as quick as possible (the drive doesn't have to be large... 8 GB should be enough, 16 GB should be more than enough, 32 GB would be far more than enough), and don't use that drive for anything else... the kernel expects quick access to swapped data and crashes if it can't access that data quickly enough (which is why I'm running two swap drives).

Sadly installing more ram is not possible right now.
But can you tell me how to set the usb as a swap drive?

  1. Buy a USB stick. As stated earlier, 8 GB should be enough, 16 GB should be more than enough, 32 GB should be far more than enough.

  2. Plug the USB stick in.

  3. In the Disks (gnome-disks) application, format the drive as a swap drive.

  4. Click the 'Gears' icon and select 'Edit Mount Options'.

  5. Select "Mount At System Startup".

  6. Select "Identify As UUID=xxxxxxx" (whatever the UUID of the drive is).

  7. Under 'Symbolic Icon Name', put "sw" (sans the quotes).

  8. Under 'Filesystem Type', put "swap" (sans the quotes).

Or you can do steps 1 through 3, then manually set up the drive in fstab (all you're doing above is setting up fstab via a GUI):

Then reboot. Test if the new swap drive is auto-mounted at boot by issuing in Terminal:
sudo swapon --show

It should look something like this:

sudo swapon --show                                                                                   # Show Swap File Status
NAME      TYPE      SIZE USED PRIO
/dev/sdb2 partition  24G   0B   -3
/dev/sda2 partition  24G   0B   -2

If it didn't auto-mount at boot, let us know, and we'll troubleshoot.

I added it and now csgo isn't even running, only the black startup intro is visible and the system boot has also slowed a little.
But at last os still freezes even in that black intro startup screen.

Can you post the results of sudo swapon --show?

Also, what USB stick are you using? If it's an older one that only supports < USB 3.0, it's going to actually slow your system, not speed it up. Keep in mind that it needs to be plugged into a USB port that supports > USB 3.0.

It might also be your non-standard kernel 6.1.15-x64v1-xanmod1. I'm out of ideas at this point.

my port is 3.0 but mu usb pendrive is 2.0
thats maybe what causing a problem!

https://www.amazon.in/HP-v236w-16GB-USB-Drive/dp/B01L8ZI7U0?th=1
This one

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.