Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak when used with DX9 applications #2

Closed
zany130 opened this issue Jan 30, 2020 · 8 comments
Closed

Memory leak when used with DX9 applications #2

zany130 opened this issue Jan 30, 2020 · 8 comments
Assignees

Comments

@zany130
Copy link

zany130 commented Jan 30, 2020

zany130.zip
for example hat in time does this https://youtu.be/Ryq41Iu7NDU it's the same in trails in the sky (DX9) bully and valkyrie chronicles 1 they will all crash right away

the mem leak also happens in vkcube but not in directx 11 games only hat in time seems to be memleaking and rise of the tombraider works fine

steps to reproduce:

  1. launch any dx9 game with PROTON_USE_D9VK=1 MANGOHUD=1 %command% in steam
  2. Mango hud will load and show your fps etc.
  3. observe freeze and possible mem leak(not all memleak) within the first minute of running the game ( games will more or less consistently crash at the same point)
  4. try any non directx9 game that is or can be translated to vulkan with MANGOHUD=1 %command%
  5. mango hud loads fine and game does not freeze
inxi -Fxxxza --no-host
System:    Kernel: 5.4.16-29-tkg-MuQSS x86_64 bits: 64 compiler: gcc v: 9.2.0 
           parameters: BOOT_IMAGE=/boot/vmlinuz-linux54-tkg-MuQSS root=UUID=db3314cf-97c1-46aa-a6c8-05cde55c83e6 rw 
           quiet nvidia-drm.modeset=1 apparmor=1 security=apparmor resume=UUID=45c1ddfa-1329-44cb-94b6-e74c8bd86bd2 
           udev.log_priority=3 
           Desktop: KDE Plasma 5.17.5 tk: Qt 5.14.0 wm: kwin_x11 dm: SDDM Distro: Manjaro Linux 
Machine:   Type: Desktop System: Gigabyte product: X470 AORUS ULTRA GAMING v: N/A serial: <filter> 
           Mobo: Gigabyte model: X470 AORUS ULTRA GAMING-CF v: x.x serial: <filter> UEFI: American Megatrends v: F50 
           date: 11/27/2019 
CPU:       Topology: 8-Core model: AMD Ryzen 7 2700X bits: 64 type: MT MCP arch: Zen+ family: 17 (23) model-id: 8 
           stepping: 2 microcode: 800820D L2 cache: 4096 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 118381 
           Speed: 3957 MHz min/max: 2200/3700 MHz boost: enabled Core speeds (MHz): 1: 3957 2: 4131 3: 4084 4: 4171 
           5: 4065 6: 4069 7: 3862 8: 4180 9: 4089 10: 4170 11: 3611 12: 4080 13: 4020 14: 4186 15: 3674 16: 4078 
           Vulnerabilities: Type: itlb_multihit status: Not affected 
           Type: l1tf status: Not affected 
           Type: mds status: Not affected 
           Type: meltdown status: Not affected 
           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 AMD retpoline, IBPB: conditional, STIBP: disabled, RSB filling 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: NVIDIA GP104 [GeForce GTX 1080] vendor: Gigabyte driver: nvidia v: 440.44 bus ID: 0a:00.0 
           chip ID: 10de:1b80 
           Display: x11 server: X.Org 1.20.7 driver: nvidia compositor: kwin_x11 tty: N/A 
           OpenGL: renderer: GeForce GTX 1080/PCIe/SSE2 v: 4.6.0 NVIDIA 440.44 direct render: Yes 
Audio:     Device-1: NVIDIA GP104 High Definition Audio vendor: Gigabyte driver: snd_hda_intel v: kernel 
           bus ID: 0a:00.1 chip ID: 10de:10f0 
           Device-2: Advanced Micro Devices [AMD] Family 17h HD Audio vendor: Gigabyte driver: snd_hda_intel v: kernel 
           bus ID: 0c:00.3 chip ID: 1022:1457 
           Sound Server: ALSA v: k5.4.16-29-tkg-MuQSS 
Network:   Device-1: Intel Wi-Fi 6 AX200 driver: iwlwifi v: kernel bus ID: 05:00.0 chip ID: 8086:2723 
           IF: wlp5s0 state: down mac: <filter> 
           Device-2: Intel I211 Gigabit Network vendor: Gigabyte driver: igb v: 5.6.0-k port: f000 bus ID: 07:00.0 
           chip ID: 8086:1539 
           IF: enp7s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
           IF-ID-1: anbox0 state: down mac: <filter> 
Drives:    Local Storage: total: 3.01 TiB used: 2.48 TiB (82.2%) 
           ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 970 EVO 250GB size: 232.89 GiB block size: physical: 512 B 
           logical: 512 B speed: 31.6 Gb/s lanes: 4 serial: <filter> rev: 2B2QEXE7 scheme: GPT 
           ID-2: /dev/nvme1n1 vendor: Samsung model: SSD 960 EVO 250GB size: 232.89 GiB block size: physical: 512 B 
           logical: 512 B speed: 31.6 Gb/s lanes: 4 serial: <filter> rev: 3B7QCXE7 scheme: GPT 
           ID-3: /dev/sda vendor: Seagate model: ST1000DM010-2EP102 size: 931.51 GiB block size: physical: 4096 B 
           logical: 512 B speed: 6.0 Gb/s rotation: 7200 rpm serial: <filter> rev: CC43 scheme: GPT 
           ID-4: /dev/sdb vendor: Seagate model: ST2000DX002-2DV164 size: 1.82 TiB block size: physical: 4096 B 
           logical: 512 B speed: 6.0 Gb/s rotation: 7200 rpm serial: <filter> rev: CC41 
           ID-5: /dev/sdc type: USB vendor: Patriot model: N/A size: 57.70 GiB block size: physical: 512 B 
           logical: 512 B serial: <filter> rev: PMAP scheme: MBR 
Partition: ID-1: / raw size: 215.45 GiB size: 211.06 GiB (97.97%) used: 150.88 GiB (71.5%) fs: ext4 dev: /dev/nvme0n1p2 
           ID-2: swap-1 size: 17.14 GiB used: 2.5 MiB (0.0%) fs: swap swappiness: 33 (default 60) 
           cache pressure: 50 (default 100) dev: /dev/nvme0n1p3 
Sensors:   System Temperatures: cpu: 59.1 C mobo: N/A gpu: nvidia temp: 34 C 
           Fan Speeds (RPM): N/A gpu: nvidia fan: 36% 
Info:      Processes: 425 Uptime: 1h 05m Memory: 15.64 GiB used: 6.32 GiB (40.4%) Init: systemd v: 242 Compilers: 
           gcc: 9.2.0 alt: 8 Shell: bash v: 5.0.11 running in: deepin-terminal inxi: 3.0.37 
@flightlessmango
Copy link
Owner

Please list system specs, distro, kernel and driver. Steps to replicate could also be good

@telans telans changed the title Directx 9 games memleak with mango hud work fine with mesa hud and without mango Memory leak when used with DX9 applications Jan 31, 2020
@telans
Copy link
Collaborator

telans commented Jan 31, 2020

Could you test with the latest nvidia-vulkan drivers?

@zany130
Copy link
Author

zany130 commented Jan 31, 2020

still memleaks on hat in time and vkcube even with the latest nvidia-vulkan drivers

@zany130
Copy link
Author

zany130 commented Feb 1, 2020

here is a lutris log i got
lutris_trails.log

@jackun
Copy link
Collaborator

jackun commented Feb 1, 2020

Could you run vkcube with debug build?

meson --reconfigure --buildtype=debug build/meson64/ && ninja  -C build/meson64 install
cp build/release/usr/lib64/libMangoHud.so $HOME/.local/share/MangoHud/libMangoHud.so

then run MANGOHUD=1 gdb vkcube and type r and press enter. When it starts to memory leak , press ctrl+c and type thread apply all bt and enter and copy the text here. Press enter to list more text if it doesn't fit on one screen and type q to exit or c to continue running.

Though running with valgrind would be more appropriate for memleaks....

@zany130
Copy link
Author

zany130 commented Feb 1, 2020

[zany130@andres-pc MangoHud]$ MANGOHUD=1 gdb vkcube
GNU gdb (GDB) 8.3.1
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from vkcube...
(No debugging symbols found in vkcube)
(gdb) 
(gdb) r
Starting program: /usr/bin/vkcube 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
/usr/lib/../share/gcc-9.2.0/python/libstdcxx/v6/xmethods.py:731: SyntaxWarning: list indices must be integers or slices, not str; perhaps you missed a comma?
  refcounts = ['_M_refcount']['_M_pi']
[Detaching after vfork from child process 22677]
[Detaching after vfork from child process 22681]
[Detaching after vfork from child process 22688]
[Detaching after vfork from child process 22689]
[Detaching after vfork from child process 22693]
[Detaching after vfork from child process 22700]
[Detaching after vfork from child process 22715]
[New Thread 0x7ffff0ad9700 (LWP 22731)]
[New Thread 0x7fffe82d8700 (LWP 22732)]
[New Thread 0x7fffebfff700 (LWP 22733)]
[Thread 0x7fffe82d8700 (LWP 22732) exited]
[Thread 0x7fffebfff700 (LWP 22733) exited]
[Thread 0x7ffff0ad9700 (LWP 22731) exited]
[New Thread 0x7ffff0ad9700 (LWP 22735)]
[New Thread 0x7fffebfff700 (LWP 22736)]
[New Thread 0x7fffe82d8700 (LWP 22737)]
[Thread 0x7fffe82d8700 (LWP 22737) exited]
[Thread 0x7fffebfff700 (LWP 22736) exited]
[Thread 0x7ffff0ad9700 (LWP 22735) exited]
[New Thread 0x7ffff0ad9700 (LWP 22738)]
[New Thread 0x7fffebfff700 (LWP 22739)]
[New Thread 0x7fffe82d8700 (LWP 22740)]
[Thread 0x7fffe82d8700 (LWP 22740) exited]
[Thread 0x7fffebfff700 (LWP 22739) exited]
[Thread 0x7ffff0ad9700 (LWP 22738) exited]
[New Thread 0x7ffff0ad9700 (LWP 22748)]
[New Thread 0x7fffebfff700 (LWP 22749)]
[New Thread 0x7fffe82d8700 (LWP 22750)]
[Thread 0x7fffe82d8700 (LWP 22750) exited]
[Thread 0x7fffebfff700 (LWP 22749) exited]
[Thread 0x7ffff0ad9700 (LWP 22748) exited]
[New Thread 0x7ffff0ad9700 (LWP 22751)]
[New Thread 0x7fffebfff700 (LWP 22752)]
[New Thread 0x7fffe82d8700 (LWP 22753)]
[Thread 0x7fffe82d8700 (LWP 22753) exited]
[Thread 0x7fffebfff700 (LWP 22752) exited]
[Thread 0x7ffff0ad9700 (LWP 22751) exited]
^C
Thread 1 "vkcube" received signal SIGINT, Interrupt.
0x00007ffff5696fac in ?? () from /usr/lib/libMangoHud.so
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff7baf740 (LWP 22673)):
#0  0x00007ffff5696fac in ?? () from /usr/lib/libMangoHud.so
#1  0x00007ffff569a315 in ?? () from /usr/lib/libMangoHud.so
#2  0x00007ffff569ffc9 in ?? () from /usr/lib/libMangoHud.so
#3  0x00007ffff56a07e3 in ?? () from /usr/lib/libMangoHud.so
#4  0x0000555555558ccd in ?? ()
#5  0x00007ffff7c0f153 in __libc_start_main () from /usr/lib/libc.so.6
#6  0x000055555555977e in ?? ()
(gdb) 

Thread 1 (Thread 0x7ffff7baf740 (LWP 22673)):
#0  0x00007ffff5696fac in ?? () from /usr/lib/libMangoHud.so
#1  0x00007ffff569a315 in ?? () from /usr/lib/libMangoHud.so
#2  0x00007ffff569ffc9 in ?? () from /usr/lib/libMangoHud.so
#3  0x00007ffff56a07e3 in ?? () from /usr/lib/libMangoHud.so
#4  0x0000555555558ccd in ?? ()
#5  0x00007ffff7c0f153 in __libc_start_main () from /usr/lib/libc.so.6
#6  0x000055555555977e in ?? ()
(gdb) c
Continuing.
^C
Thread 1 "vkcube" received signal SIGINT, Interrupt.
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append (
    this=0x7fffffffc7d0, __s=0x7ffff575f84d " ")
    at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:1263
1263	/build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h: No such file or directory.
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff7baf740 (LWP 22673)):
#0  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append (this=0x7fffffffc7d0, __s=0x7ffff575f84d " ") at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:1263
#1  0x00007ffff5696fcb in ?? () from /usr/lib/libMangoHud.so
#2  0x00007ffff569a315 in ?? () from /usr/lib/libMangoHud.so
#3  0x00007ffff569ffc9 in ?? () from /usr/lib/libMangoHud.so
#4  0x00007ffff56a07e3 in ?? () from /usr/lib/libMangoHud.so
#5  0x0000555555558ccd in ?? ()
#6  0x00007ffff7c0f153 in __libc_start_main () from /usr/lib/libc.so.6
#7  0x000055555555977e in ?? ()
(gdb) Quit
(gdb) q
A debugging session is active.

	Inferior 1 [process 22673] will be killed.

Quit anyway? (y or n) y
[zany130@andres-pc MangoHud]$ cp build/release/usr/lib64/libMangoHud.so /usr/libMangoHud.so
bin/                i686-w64-mingw32/   lib/                lib64/              local/              share/              x86_64-w64-mingw32/ 
doc/                include/            lib32/              libexec/            sbin/               src/                
[zany130@andres-pc MangoHud]$ cp build/release/usr/lib64/libMangoHud.so /usr/liblibMangoHud.so
lib/     lib32/   lib64/   libexec/ 
[zany130@andres-pc MangoHud]$ cp build/release/usr/lib64/libMangoHud.so /usr/lib/libMangoHud.so
Display all 5573 possibilities? (y or n)
[zany130@andres-pc MangoHud]$ cp build/release/usr/lib64/libMangoHud.so /usr/lib/libMangoHud.so 
assets/                                         .git/                                           lib32-mangohud-r45.58384b0-1-x86_64.pkg.tar.xz  pkg/
bin/                                            .gitignore                                      mangohud-r45.58384b0-1-x86_64.pkg.tar.xz        PKGBUILD
build/                                          .gitmodules                                     meson.build                                     README.md
build.sh                                        include/                                        modules/                                        src/
[zany130@andres-pc MangoHud]$ cp build/release/usr/lib64/libMangoHud.so /usr/lib/libMangoHud.so 
cp: unwritable '/usr/lib/libMangoHud.so' (mode 0664, rw-rw-r--); try anyway? 
[zany130@andres-pc MangoHud]$ sudo cp build/release/usr/lib64/libMangoHud.so /usr/lib/libMangoHud.so 
[sudo] password for zany130: 
[zany130@andres-pc MangoHud]$ MANGOHUD=1 gdb vkcube
GNU gdb (GDB) 8.3.1
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from vkcube...
(No debugging symbols found in vkcube)
(gdb)   r
Starting program: /usr/bin/vkcube 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
/usr/lib/../share/gcc-9.2.0/python/libstdcxx/v6/xmethods.py:731: SyntaxWarning: list indices must be integers or slices, not str; perhaps you missed a comma?
  refcounts = ['_M_refcount']['_M_pi']
[Detaching after vfork from child process 24365]
[Detaching after vfork from child process 24369]
[Detaching after vfork from child process 24376]
[Detaching after vfork from child process 24377]
[Detaching after vfork from child process 24381]
[Detaching after vfork from child process 24388]
[Detaching after vfork from child process 24408]
[New Thread 0x7ffff0ad9700 (LWP 24419)]
[New Thread 0x7ffff02d8700 (LWP 24420)]
[New Thread 0x7fffefad7700 (LWP 24421)]
[Thread 0x7ffff02d8700 (LWP 24420) exited]
[Thread 0x7fffefad7700 (LWP 24421) exited]
[Thread 0x7ffff0ad9700 (LWP 24419) exited]
[New Thread 0x7ffff0ad9700 (LWP 24422)]
[New Thread 0x7fffefad7700 (LWP 24423)]
[New Thread 0x7ffff02d8700 (LWP 24424)]
[Thread 0x7ffff02d8700 (LWP 24424) exited]
[Thread 0x7fffefad7700 (LWP 24423) exited]
[Thread 0x7ffff0ad9700 (LWP 24422) exited]
^C
Thread 1 "vkcube" received signal SIGINT, Interrupt.
updateCpuStrings () at ../../src/cpu_gpu.h:255
255	    for (size_t i = 0; i < correctionValue; i++) {
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff7baf740 (LWP 24360)):
#0  updateCpuStrings () at ../../src/cpu_gpu.h:255
#1  0x00007ffff569a315 in snapshot_swapchain_frame (data=0x555555d2f870) at ../../src/overlay.cpp:910
#2  0x00007ffff569ffc9 in before_present (swapchain_data=0x555555d2f870, present_queue=0x555555b44fb0, wait_semaphores=0x7fffffffcfa0, n_wait_semaphores=1, imageIndex=1) at ../../src/overlay.cpp:2012
#3  0x00007ffff56a07e3 in overlay_QueuePresentKHR (queue=0x555555595340, pPresentInfo=0x7fffffffcd40) at ../../src/overlay.cpp:2132
#4  0x0000555555558ccd in ?? ()
#5  0x00007ffff7c0f153 in __libc_start_main () from /usr/lib/libc.so.6
#6  0x000055555555977e in ?? ()
(gdb) c
Continuing.
^C
Thread 1 "vkcube" received signal SIGINT, Interrupt.
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append (
    this=0x7fffffffc7c0, __s=0x7ffff575f84d " ")
    at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:1266
1266	/build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h: No such file or directory.
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff7baf740 (LWP 24360)):
#0  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append (this=0x7fffffffc7c0, __s=0x7ffff575f84d " ") at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:1266
#1  0x00007ffff5696fcb in updateCpuStrings () at ../../src/cpu_gpu.h:256
#2  0x00007ffff569a315 in snapshot_swapchain_frame (data=0x555555d2f870) at ../../src/overlay.cpp:910
#3  0x00007ffff569ffc9 in before_present (swapchain_data=0x555555d2f870, present_queue=0x555555b44fb0, wait_semaphores=0x7fffffffcfa0, n_wait_semaphores=1, imageIndex=1) at ../../src/overlay.cpp:2012
#4  0x00007ffff56a07e3 in overlay_QueuePresentKHR (queue=0x555555595340, pPresentInfo=0x7fffffffcd40) at ../../src/overlay.cpp:2132
#5  0x0000555555558ccd in ?? ()
#6  0x00007ffff7c0f153 in __libc_start_main () from /usr/lib/libc.so.6
#7  0x000055555555977e in ?? ()

@zany130
Copy link
Author

zany130 commented Feb 1, 2020

just realized i posted two runs i guess thats fine 1st run was without copying build/release/usr/lib64/libMangoHud.so

the second was after copying it /usr/lib/ as $HOME/.local/share/MangoHud/libMangoHud.so did not exist

@flightlessmango
Copy link
Owner

This issue was resolved here 3d71100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants