flightlessmango / MangoHud

A Vulkan and OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load and more. Discord: https://discordapp.com/invite/Gj5YmBb
MIT License
6.37k stars 282 forks source link

Memory leak when used with CS:GO #223

Closed ghost closed 3 years ago

ghost commented 4 years ago

When I use mangohud overlay with cs:go it causes memory leak( used up all of my 16GB ram in around 30 min) and also stuttering and lower framerates in general compared to what steam fps counter reports when playing game without mango hud.

System:    Kernel: 5.4.44-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.1.0 
           parameters: BOOT_IMAGE=/boot/vmlinuz-5.4-x86_64 root=UUID=e4c83824-714e-40d4-a8a8-7bf6779b3882 rw quiet 
           udev.log_priority=3 
           Desktop: i3 4.18.1 info: i3bar dm: LightDM 1.30.0 Distro: Manjaro Linux 
Machine:   Type: Laptop System: HP product: OMEN by HP Laptop 15-dc0xxx v: N/A serial: <filter> Chassis: type: 10 
           serial: <filter> 
           Mobo: HP model: 84DA v: 93.18 serial: <filter> UEFI: AMI v: F.05 date: 06/15/2018 
Battery:   ID-1: BAT0 charge: 40.5 Wh condition: 40.5/40.5 Wh (100%) volts: 12.7/11.6 model: HP Primary type: Li-ion 
           serial: <filter> status: Full 
CPU:       Topology: 6-Core model: Intel Core i7-8750H bits: 64 type: MT MCP arch: Kaby Lake family: 6 model-id: 9E (158) 
           stepping: A (10) microcode: CA L2 cache: 9216 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 52815 
           Speed: 954 MHz min/max: 800/4100 MHz Core speeds (MHz): 1: 4004 2: 4042 3: 3958 4: 3961 5: 4090 6: 4043 7: 3966 
           8: 4041 9: 4029 10: 4054 11: 4030 12: 3992 
           Vulnerabilities: Type: itlb_multihit status: KVM: Split huge pages 
           Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
           Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
           Type: meltdown mitigation: PTI 
           Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp 
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: Intel UHD Graphics 630 vendor: Hewlett-Packard driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:3e9b 
           Device-2: NVIDIA GP107M [GeForce GTX 1050 Ti Mobile] vendor: Hewlett-Packard driver: nvidia v: 440.82 
           bus ID: 01:00.0 chip ID: 10de:1c8c 
           Display: x11 server: X.Org 1.20.8 driver: modesetting,nvidia resolution: 1920x1080~144Hz 
           OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 20.0.7 direct render: Yes 
Audio:     Device-1: Intel Cannon Lake PCH cAVS vendor: Hewlett-Packard driver: snd_hda_intel v: kernel bus ID: 00:1f.3 
           chip ID: 8086:a348 
           Sound Server: ALSA v: k5.4.44-1-MANJARO 
Network:   Device-1: Intel Wireless-AC 9560 [Jefferson Peak] driver: iwlwifi v: kernel port: 5000 bus ID: 00:14.3 
           chip ID: 8086:a370 
           IF: wlo1 state: up mac: <filter> 
           Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Hewlett-Packard driver: r8169 v: kernel 
           port: 3000 bus ID: 03:00.0 chip ID: 10ec:8168 
           IF: eno1 state: down mac: <filter> 
Drives:    Local Storage: total: 1.03 TiB used: 883.09 GiB (84.0%) 
           ID-1: /dev/nvme0n1 vendor: Samsung model: MZVLW128HEGR-000H1 size: 119.24 GiB block size: physical: 512 B 
           logical: 512 B speed: 31.6 Gb/s lanes: 4 serial: <filter> rev: CXB73H1Q scheme: GPT 
           ID-2: /dev/sda vendor: Seagate model: ST1000LM049-2GH172 size: 931.51 GiB block size: physical: 4096 B 
           logical: 512 B speed: 6.0 Gb/s rotation: 7200 rpm serial: <filter> rev: RXM3 scheme: GPT 
RAID:      Hardware-1: Intel 82801 Mobile SATA Controller [RAID mode] driver: ahci v: 3.0 port: 5060 bus ID: 00:17.0 
           chip ID: 8086.282a rev: 10 
Partition: ID-1: / raw size: 29.30 GiB size: 28.71 GiB (98.00%) used: 25.42 GiB (88.5%) fs: ext4 dev: /dev/nvme0n1p5 
Sensors:   System Temperatures: cpu: 57.0 C mobo: N/A 
           Fan Speeds (RPM): N/A 
Info:      Processes: 306 Uptime: 1h 07m Memory: 15.49 GiB used: 1.22 GiB (7.9%) Init: systemd v: 245 Compilers: gcc: 10.1.0 
           clang: 10.0.0 Shell: bash v: 5.0.17 running in: urxvt inxi: 3.0.37

I am new to this so please tell me if i can provide any more info

Edit: I just tried the git-version from AUR and it still has the same issue. Also i just add mangohud prime-run %command% to steam. Also tried prime-run mangohud %command%. Also I had added export DRI_PRIME=1 to the csgo.sh file and i haven't removed it.

raspin0 commented 4 years ago

I've the same thing, but I thought it's caused by the game itself.

flightlessmango commented 4 years ago

Is it specific to CSGO? Try disabling some features MANGOHUD_CONFIG=gpu_stats=0,cpu_stats=0,frame_timing=0 and see if it's still happening

ghost commented 4 years ago

I tried witcher 3 with dxvk and it didn't seem to have an issue. CS:GO is the only native OpenGL game I have, so I cant test that hypothesis. CS:GO still had a memory leak after disabling the features you specified. I am using the AUR git version now.

ghost commented 4 years ago

If i disable dxvk from lutris, neither mangohud nor mangohud.x86 shows anything in witcher 3. I tried this because I thought since it would run on OpenGL and we could learn something.

flightlessmango commented 4 years ago

You need to use MANGOHUD_DLSYM=1 for wined3d (opengl)

ghost commented 4 years ago

There doesn't seem to be a memory leak with witcher 3 even on OpenGL

ghost commented 4 years ago

I tried Left4Dead 2 and it didn't seem to have a memory leak. And I just confirmed again that CS:GO indeed has a memory leak

joan31 commented 4 years ago

Hi,

I have the same issue with CS GO.

My setup : CPU AMD 2700X MEMORY 16 GB GPU RX 5700 XT OS Arch Linux + I3WM

af7567 commented 4 years ago

I seem to have the same problem with CS:GO/OpenGL. I don't know about the memory leak because I didn't use it for long enough, but I definitely get the stuttering and fps drop. I have just experimented with different settings and reloading with shift+F4 and it is gpu_stats being enabled that causes the problem for me, with or without gpu_temp enabled.

With vulkan games I didn't have any problems.

Linux 5.7.2, nvidia driver 440.82, nvidia GTX970, Ryzen 5 2600

joan31 commented 4 years ago

I put a # before gpu_stats and it still displayed ... Other parameters can be hidden... but with gpu_stats, cpu_stats, frame_timing, I comment this, but they still displayed ....

jackun commented 4 years ago

gpu_stats=0

joan31 commented 4 years ago

Thank you. So I can confirm, without gpu_stats it work fine. gpu_stats cause the problem if it is enabled.

flightlessmango commented 4 years ago

I might have fixed it here, needs some testing MangoHud.tar.gz

raspin0 commented 4 years ago

Can confirm, memory leak appears to be fixed as of mangohud 0.5.1

jackun commented 3 years ago

Issue was CSGO constantly switching between OpenGL contexts when opening menus etc. making MangoHud reinit ImGui (even though Unreal4 does the same).