csgo-osx-linux icon indicating copy to clipboard operation
csgo-osx-linux copied to clipboard

Huge CS2 memory leaks

Open RodolpheGohard opened this issue 1 year ago • 48 comments

Your system information

  • System information from steam: link
  • Have you checked for system updates?: Yes

Please describe your issue in as much detail as possible:

While I play, the memory consumption goes up without ever releasing, until crash. See this example where mem usage is 15.8Gb :

image

I have seen it use more than 24Gb RAM, starting to make my system unstable.

This happens while playing about ~1 ~2h. If the memory usage is too high my system becomes less stable and responsive, probably due to memory swapping, which makes the game unplayable then.

Steps for reproducing this issue:

  1. open game
  2. play

RodolpheGohard avatar Feb 29 '24 13:02 RodolpheGohard

anyone on this plz ? @kisak-valve

vonclutch avatar Mar 01 '24 20:03 vonclutch

I think it's covered in other bugs but yes. I am also having a memory leak issue. It seems to be only my account, a friends account did not have it on my machine so makes me suspect some setting. Also something about Overpass seems to trigger this eating memory, the character in the buy menu goes a red tint and memory is consumed until your in swap which makes the game unplayable. You have to close the game to release the memory.

sixwheeledbeast avatar Mar 02 '24 23:03 sixwheeledbeast

Its also related to this #3642

ZeroYamaoka avatar Mar 04 '24 09:03 ZeroYamaoka

My suggestion is change texture settings to low because memory leak is related to Vulkan when your GPU memory is overloaded it transfer some to ram memory

ZeroYamaoka avatar Mar 04 '24 12:03 ZeroYamaoka

My suggestion is change texture settings to low because memory leak is related to Vulkan when your GPU memory is overloaded it transfer some to ram memory

Nah it's not from vulkan. I've got a clean install with xorg and gnome and still got the bug. I did downgrade my kernel from 6.6 to 6.1. not gonna say it's fixed it but it's 10 times better at least.

vonclutch avatar Mar 04 '24 22:03 vonclutch

Its also related to this #3642

The problems I experience don't exactly look like this.

Is there anything I can do / run to help diagnose this ? Also, This is the first game where I see this, I can run games like Final Fantasy or Doom Eternal Fine and they do fine, even though I am under the impression that they use vulkan and they have larger assets, larger maps to load.

RodolpheGohard avatar Mar 05 '24 18:03 RodolpheGohard

Decided to compare linux vs windows with both dx11 and vulkan. I saw the following after spending ~90 minutes with each.

Ram usage (just the game) Start Peak End
linux 2GB 6.4GB 6GB
windows dx11 5.1GB 7.8GB 5.8GB
windows vk 5.1GB 11.8GB 10.8GB

Configuration: Ryzen 5600G, RX 6600, 32GB of ram. Arch linux with stock kernel 6.8.2 and mesa 24.0.4, windows 10 with amd 24.3.1. The rest of my linux system took 3.5GB of ram, the rest of the windows system to 4.2GB.

It should be noted that dx11 actually ran with higher settings than the vulkan attempts because the settings reset and I didn't notice until I was done testing. DX11 was set to high preset, vulkan (both OSes) were set to medium preset, except with FSR disabled.

"End" was measured in the title screen. All 3 tests went through 7 different maps in the game in official servers. I'm not sure if there's anything in particular that makes the ram usage keep growing, map changes can increase it, but sometimes it remains the same. While I didn't see this in this session, last week cs2 took half of my ram on linux to the point my system started swapping due to having more things running in the background that time. Given that there were some updates from then to now, I don't know if the updates improved things or if this was down to luck.

Edit: On a different, 70 minutes long linux session, cs2's ram usage ballooned up to 12,8GB which then went down to 11,7GB when returning to the main menu. So despite being a somewhat shorter session, it ended consuming a lot more ram, twice as much as the previous one.

simifor avatar Apr 08 '24 23:04 simifor

I dont live this issue anymore. My ram is idle but sometimes game gets lagged as if there is memory leak. When i play for some time like 2 or 3 hours

DavutHaxor avatar May 02 '24 18:05 DavutHaxor

I have lowered the texture quality.

It's better, I can run the game longer, but the issue is still there. Given enough time playing and changing maps, the memory usage builds up and the performance degrades, particularily on maps featuring water patches (Ancient and Anubis for example)

RodolpheGohard avatar May 03 '24 14:05 RodolpheGohard

im having the same issue (memory leak) on Ubuntu 22.04.4 LTS (64 bit), Kernel Version: 6.5.0-28-generic, Driver Version: 4.6.0 NVIDIA 545.29.06, Driver: NVIDIA Corporation NVIDIA GeForce GTX 1660 SUPER

daniil-zilin avatar May 07 '24 03:05 daniil-zilin

Same issue. After a few rounds my memory usage skyrockets from ~8GiB to ~20GiB, eventually causing frame loss, stuttering and frame drops while shooting and getting shot, and eating into swap memory. I have also noticed that all 8GB of vram gets used up immediately as well as near 100% GPU usage at all times.

All settings are on high, Windows shows none of these issues.

System: Arch Linux 6.9.7-zen1-1-zen GPU: NVIDIA GeForce RTX 3070 Ti Driver Version: NVIDIA 555.58 DE: KDE 6.1.2 WM: Wayland

Arcticzomb avatar Jul 03 '24 20:07 Arcticzomb

valve pls fix

Extravi avatar Jul 05 '24 00:07 Extravi

Cont. of my previous comment

Same issue. After a few rounds my memory usage skyrockets from ~8GiB to ~20GiB, eventually causing frame loss,

I did a fresh install of Arch which seems to have solved this issue. I have no clue whether it's a user space or system space configuration issue. I switched through a few maps with bots, playing a few rounds each, and memory went and and down as expected from the base game. It averaged ~6.6GiB sometimes going higher before coming back down.

Edit: After 2 wingman matches my memory is steadying out at ~11GiB. Memory only seems to be majorly affected when playing multiplayer

Edit 2: Nope, issue not fixed. After playing another round I jumped to 16 GiB usage and low frames when shooting/others shot.

Edit 3: So, it seems that at the start/very end of every round the game allocates ~.1 GiB of memory. This still applies to both multiplayer and playing vs bots locally. Ignore the second sentence from the first edit.

Arcticzomb avatar Jul 06 '24 05:07 Arcticzomb

Here's my metrics from node-exporter. Just before 01:00 is when I started CS2 and played two matches (until just after 02:00) image

❯ neofetch
                   -`                    [email protected]
                  .o+`                   ---------------------
                 `ooo/                   OS: Arch Linux x86_64
                `+oooo:                  Kernel: 6.9.9-arch1-1
               `+oooooo:                 Uptime: 12 hours, 42 mins
               -+oooooo+:                Packages: 1149 (pacman), 47 (flatpak)
             `/:-:++oooo+:               Shell: bash 5.2.26
            `/++++/+++++++:              Resolution: 3840x2160
           `/++++++++++++++:             DE: GNOME 46.3.1 (Wayland)
          `/+++ooooooooooooo/`           WM: Mutter
         ./ooosssso++osssssso+`          WM Theme: Adwaita
        .oossssso-````/ossssss+`         Theme: Adwaita-dark [GTK2/3]
       -osssssso.      :ssssssso.        Icons: Adwaita [GTK2/3]
      :osssssss/        osssso+++.       Terminal: tmux
     /ossssssss/        +ssssooo/-       CPU: AMD Ryzen 7 5800X (16) @ 3.800GHz
   `/ossssso+/:-        -:/+osssso+-     GPU: NVIDIA GeForce RTX 3070 Ti (v555.58.02)
  `+sso+:-`                 `.-/+oso:    Memory: 12237MiB / 64217MiB
 `++:.                           `-/+/
 .`                                 `/

ghjnut avatar Jul 09 '24 17:07 ghjnut

debian-testing, rx580, memory leak at online matchmaking with other players

koreanfan avatar Jul 09 '24 21:07 koreanfan

For those affected, it would be nice to list:

  • distribution and version
  • DE with version like kde 6.1/gnome 4.3/etc
  • wayland or X11
  • video card model and driver with version

The leak is probably not affecting the Steam Deck env (they might have tested it for more than 2 hours). So, it might be something not used there.

luizluca avatar Jul 10 '24 05:07 luizluca

  • Arch Linux, kernel 6.9.8-zen1-1.1-zen
  • Hyprland v0.41.2
  • Wayland
  • RTX 3070 with driver version 555.58.02

Memory leak occuring on my end, causing fps to slowly tank as well whilst playing. Using streched res, vulkan, and native wayland enabled in cs2.sh

Disabling these options and reverting to a fully stock vulkan cs2 does not help.

fxzzi avatar Jul 12 '24 16:07 fxzzi

  • Debian 12 6.9.8-1-liquorix-amd64
  • X11 XFCE4
  • RX 6600 + Mesa 24.1.3-2

Disabling swap helps at least for me since I'm still on a 400MB/s SSD. Memory pressure builds until the implications on performance make the game unplayable, with sprays and executes at 30 FPS. Results in oom kill once it hits my max of 16gb (around an hour in).

Tested with Mesa 22.3.6 - also present.

I'm not sure about the posts before this week but given many noticed this issue recently, surely this must be a recent cs2 regression?

nJ3ahxac avatar Jul 13 '24 17:07 nJ3ahxac

  • Linux Mint 21.3 x86_64
  • 5.15.0-113-generic
  • Cinnamon 6.0.4
  • Mutter (Muffin)
  • NVIDIA GeForce GTX 1650 Mobile
  • NVIDIA Driver Version: 535.183.01
  • X.Org

Extravi avatar Jul 13 '24 18:07 Extravi

image

Extravi avatar Jul 16 '24 15:07 Extravi

steam support said we should submit the issue here: https://github.com/ValveSoftware/steam-for-linux/issues

Extravi avatar Jul 17 '24 05:07 Extravi

also pc freeze in cs2 main menu for 5-10 seconds

koreanfan avatar Jul 19 '24 03:07 koreanfan

also pc freeze in cs2 main menu for 5-10 seconds

same issue game is terrible on Linux

Extravi avatar Jul 19 '24 03:07 Extravi

  • Ubuntu 24.04 LTS
  • GNOME Shell 46.0
  • Wayland
  • Radeon RX 6650 XT + Mesa 24.0.9-0ubuntu0.1

bottrall avatar Jul 21 '24 00:07 bottrall

Tested with separate hardware with mostly identical software, settings on High:

14600KF + 7900 XTX (24GB VRAM) 5600x + 6600 (8GB VRAM)

For the 6600, we saw a massive increase in RAM with VRAM topping out at 7gb. For the 7900 XTX, we saw little to no increase in RAM, with vram topping out at 11gb. No performance degradation for the 7900 XTX. Massive degradation for the 6600.

I'm going to speculate that the problem is some kind of logic error regarding memory over-commitment. These slides about the vulkan specification at page 24 describe the specifics of memory management in a constrained scenario. Depending on the driver the system might allocate RAM instead of VRAM and naturally this degrades performance. The slides explicitly state what we encounter.

I don't want to speculate much further but it's likely that in this scenario memory which is not allocated to VRAM is marked as failing to allocate, despite the fact that it does, resulting in a steady memory leak. This seems to only occur once VRAM is topped out to ~85% of its maximum size.

nJ3ahxac avatar Jul 21 '24 07:07 nJ3ahxac

Replying to https://github.com/ValveSoftware/csgo-osx-linux/issues/3687#issuecomment-2241503860

i agree

Extravi avatar Jul 21 '24 18:07 Extravi

R5 5600G + RX 6650 XT (8 GB VRAM) + 16 GB RAM Manjaro with stock 6.10 Kernel (just did a reinstall, had the same problem before and for a while)

I usually get through one full game fine, if I do not restart CS afterwards, I get freezes during the second game. If I'm not quick in restarting CS, the system fully crashes and only power off works.

lxmadabc avatar Jul 29 '24 13:07 lxmadabc

After playing some surf and then a single game of wingman on Memento. 2024-08-07-131602_screenshot This ss is from System Monitor while in the main menu of CS2 app name, cpu%, memory, and upload

Arcticzomb avatar Aug 07 '24 18:08 Arcticzomb

This may help some people. I don't believe the steam client tells sniper runtime to use the beta version automatically. I was looking through all the settings trying to work this out. As on the same hardware I have different results on two accounts. I seemed to have stopped this memory leaking from selecting the beta for sniper in steam. I am running the beta steam client. If this is the issue it would be sensible if sniper could detect that the client is the beta version and update accordingly. FPS and general buggy-ness has also improved greatly. ~30-60FPS to ~160-230.

sixwheeledbeast avatar Aug 15 '24 11:08 sixwheeledbeast

I seemed to have stopped this memory leaking from selecting the beta for sniper in steam. I am running the beta steam client.

Unfortunately I couldn't replicate this.

nJ3ahxac avatar Aug 18 '24 13:08 nJ3ahxac