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

Disabling VSync causes memory leak #77304

Closed
loneShade221 opened this issue May 21, 2023 · 9 comments · Fixed by godotengine/godot-docs#7198
Closed

Disabling VSync causes memory leak #77304

loneShade221 opened this issue May 21, 2023 · 9 comments · Fixed by godotengine/godot-docs#7198

Comments

@loneShade221
Copy link

loneShade221 commented May 21, 2023

Godot version

4.0.3 stable (applies to 4.0.1 stable, and 4.0.2 stable as well)

System information

Windows 7, AMD Athlon X4 860 Quad Core Processor, AMD Radeon R7 250 Series

Issue description

Disabling VSync in the Project Settings (as well as in GDScript) sometimes causes a ~60-80 kB/second memory leak, as observed in the Windows Task Manager. The leak happens after running the application for about 10 seconds, after which the memory leak will endlessly pile on, without it being noticed in any of the Godot monitors.
This happens with the Forward+ renderer, the others don't seem to have this issue.

Steps to reproduce

-Run the Windows Task Manager,
-Make sure that the project uses the Forward+ renderer
-Disable VSync in the Project Settings (or GDScript with the DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED); line.)
-Run the your application by clicking the Run Project button,
-Wait for about 10-15 seconds, after which the leak will begin

Minimal reproduction project

Any project will do, simply add a new Node2D, disable VSync, and run the project.

@AThousandShips
Copy link
Member

Shouldn't it be something other than DisplayServer.VSYNC_DISABLED

@loneShade221 loneShade221 changed the title Enabling VSync causes memory leak Disabling VSync causes memory leak May 21, 2023
@loneShade221
Copy link
Author

My bad, I typed Enable instead of Disabled.

@AThousandShips
Copy link
Member

Cannot confirm on latest version

@loneShade221
Copy link
Author

Do you have any idea why this might happen? It's a pretty big issue for me:
Desktop 5-21-2023 1-46-59 PM-306
Desktop 5-21-2023 1-47-21 PM-529
Desktop 5-21-2023 1-47-26 PM-894

This scene is just a Node2D. Maybe it has something to do with drivers?

@AThousandShips
Copy link
Member

Updating your drivers is always a good idea to eliminate problems, this could be a Win7 specific issue, as I am on Win11 and unable to replicate this issue

@Calinou
Copy link
Member

Calinou commented May 21, 2023

The fact that disabling V-Sync causes a memory leak is more that uncapping the framerate causes the engine to render far more frames, making memory leak much faster. You can confirm this by leaving V-Sync disabled but setting the Max FPS advanced project setting to 60.

@loneShade221
Copy link
Author

Yes, I have noticed that while I was doing some more testing on this issue. I updated my drivers, though it still didn't fix the issue, and the memory leak, although slower when the FPS is capped, is still there, and will eventually eat up memory completely. I didn't bother much with it after this, I simply enabled VSync and left it at that. Since the issue cannot be replicated on later Windows versions, this might be a Win7 limitation with Godot.

@Calinou
Copy link
Member

Calinou commented May 21, 2023

Vulkan on Windows 7 tends to have various issues not found on more recent Windows versions. Given you're also on an old GPU (GCN 2.0 GPUs only have partial Direct3D 12 support for instance), it's best to stick to the Compatibility rendering method there.

@loneShade221
Copy link
Author

Yeah, I understand, thank you informing me. 👍

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

Successfully merging a pull request may close this issue.

3 participants