-
-
Notifications
You must be signed in to change notification settings - Fork 24.9k
[3.x] Game consumes 100% CPU if the window is covered by another OS window (macOS) #64708
Description
Godot version
v3.5.stable.official [991bb6a]
System information
macOS 12.5.1 (21G83), Apple M1 Max MacBook Pro
Issue description
Simply covering up the game's window with another OS window causes CPU usage to spike to 100%. You can see this in action in the video:
Screen.Recording.2022-08-21.at.4.43.46.PM.mov
Steps to reproduce
Run the attached project (or any project, really - the attached one is essentially empty and has no scripts) on macOS. Drag a window over top of the game's window (it needs to cover it completely). Watch as CPU usage skyrockets.
My uninformed suspicion is that macOS detects when the window is covered and stops sending rendering/v-sync events to the app in an effort to save power. Godot may be waiting for those events in an inefficient polling loop and when they stop coming that loop starts burning up cycles.
Godot now has the distinction of being the first app on my M1 Max that's actually managed to get the fan to run because of this. I noticed it because I have a habit of leaving the game open behind other windows when I switch back to the editor to keep working on it. I don't think this is an uncommon habit, tbh, and this behavior would have caused Godot to very rapidly deplete my laptop's battery if I hadn't happened to be running while plugged in.
Minimal reproduction project
Metadata
Metadata
Assignees
Type
Projects
Status