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

Vulkan: Huge memory usage and performance drop after resizing the game window #60110

Closed
marcinn opened this issue Apr 10, 2022 · 5 comments
Closed

Comments

@marcinn
Copy link
Contributor

marcinn commented Apr 10, 2022

Godot version

v4.0.alpha.custom_build.eb6ebdc4a

System information

Manjaro Linux, 5.10.105-1-MANJARO, x86_64, NVIDIA GM107GLM [Quadro M620 Mobile] nvidia 510.54, X11, Vulkan

Issue description

After resizing the game window, fps are dropped by about half. Also there is noticeable huge memory usage, which also looks like a memory leak. And when you resize the window few times more, you should hang your OS due to out of memory.

https://www.youtube.com/watch?v=Xd9wGFQBbzk

The issue exists both on X11 and Gnome/Wayland.

Steps to reproduce

  1. Open the project and run the main scene
  2. Make window way smaller. You should notice a huge lag and increased memory usage.
  3. Then the memory usage will drop almost to original value, but it will be slightly greater. Performance will be dropped about half (check fps)
  4. Resize the window few times more in a short time. Your PC will hang due to OOM.

Minimal reproduction project

Should be any project, but I'm attaching the one used to record the video.
PopupCrash.zip

@marcinn marcinn changed the title Huge memory usage and performance drop after resizing the game window Vulkan: Huge memory usage and performance drop after resizing the game window Apr 10, 2022
@Calinou Calinou added this to the 4.0 milestone Apr 10, 2022
@Calinou
Copy link
Member

Calinou commented Apr 10, 2022

Related to #56205.

In general, changing graphics settings can cause various resource leaks, which you can test by using https://github.com/Calinou/godot-photo-mode-demo.

@avilches
Copy link
Contributor

avilches commented Nov 25, 2022

I do confirm this is happening in Godot 4 beta 6 too. FPS drops from 60 to 20, 6... 1 after resizing window some times, tested in a ported game from Godot 3.0. (It's a 2D game, no fog)

@akien-mga akien-mga moved this to To Assess in 4.x Priority Issues Nov 25, 2022
@YuriSizov YuriSizov moved this from To Assess to Todo in 4.x Priority Issues Nov 26, 2022
@clayjohn clayjohn modified the milestones: 4.0, 4.x Feb 23, 2023
@darksylinc
Copy link
Contributor

Is this still an issue? I cannot reproduce this issue on Xubuntu 20.04 with Godot 4.2 master on AMD GPUs.

Neither the memory leak nor the performance degradation. However the perf degradation could be NVIDIA specific.

I noticed this triggers a pathological case of #80570 which will be fixed when #80571 gets merged.

Thus perhaps after merging that PR the slowdown will be gone?

@Calinou
Copy link
Member

Calinou commented Aug 14, 2023

https://github.com/Calinou/godot-photo-mode-demo in 4.2.dev3 on a NVIDIA GeForce RTX 4090 exhibits permanently increased VRAM usage after settings are temporarily increased once (from 3.8 GB to 5.3 GB), and then twice (from 5.3 GB to 5.5 GB). Subsequent settings toggles don't affect VRAM usage significantly:

simplescreenrecorder-2023-08-14_14.50.41.mp4

However, if I perform the same operation in 4K, a permanent performance drop occurs after VRAM is fully exhausted by the settings toggle. (This photo mode internally renders the viewport in 8K if the window size is 4K.)

simplescreenrecorder-2023-08-14_14.52.34.mp4

VRAM exhaustion is supposed to destroy performance, but I think performance should go back to normal levels after VRAM usage goes to normal levels and previous settings are restored.

Edit: Moved to #81258.

@lostminds
Copy link

Regarding the memory leak when resizing the window, could that be the same as #77295 ? Still an issue on 4.2.dev3 now that I tried it.
Seems like it's allocating a large number of new buffers of some sort for the new size during window resize that aren't properly released as the window keeps changing size and new resources are allocated for the new size.

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

8 participants