From time to time, glfwCreateWindow will take up to 50 seconds to return on OSX. This seems to occur most often on a fresh boot of the machine or if the game hasn’t been started in a few hours. Under normal circumstances, it completes within 1 second and everything is fine. I’m using GLFW v3.2 in my game and testing fullscreen window creation on an iMac running the latest OSX.
Any ideas what could be causing this and if there’s a workaround?
Dual monitor - with fullscreen window creating on the primary monitor (I’m trying to reproduce it in single monitor, but it’s a pain to reproduce with a reboot each time)
Dual screen (first attempt):
Library initialized
Creating full screen window 1 (1920x1080 on iMac)
Main loop starting
00000000 to 1 at 0.550: Window refresh
00000001 to 1 at 2.058: Window focused
00000002 to 1 at 2.061: Cursor entered window
00000003 to 1 at 4.875: Key 0x0157 Scancode 0x0037 (LEFT SUPER) (with super) was pressed
00000004 to 1 at 5.225: Window close
Single monitor:
Library initialized
Creating full screen window 1 (1920x1080 on iMac)
Main loop starting
00000000 to 1 at 0.526: Window refresh
00000001 to 1 at 0.678: Window focused
00000002 to 1 at 0.681: Cursor entered window
00000003 to 1 at 3.025: Key 0x0157 Scancode 0x0037 (LEFT SUPER) (with super) was pressed
00000004 to 1 at 4.369: Window close
Dual monitor (after plugging monitor back in):
Library initialized
Creating full screen window 1 (1920x1080 on iMac)
Main loop starting
00000000 to 1 at 0.538: Window refresh
00000001 to 1 at 0.700: Window focused
00000002 to 1 at 0.703: Cursor entered window
00000003 to 1 at 2.811: Key 0x0157 Scancode 0x0037 (LEFT SUPER) (with super) was pressed
00000004 to 1 at 3.310: Window close
Without knowing what OS call is taking so long, I’m afraid I don’t know what to do. How often does this delay happen? Would you be able to profile it while it happens, or find it with a debugger?
I see - thanks for looking into this. I’ll try to profile or debug and I’ll report back if I find anything.
It happens the first time the game is launched since the last boot of the machine - so unfortunately that might mean a bad first impression for the first launch of my game on dual screen OSX machines. It also seems to happen again after a couple of hours - perhaps something the OS caches is reclaimed leading to the delay the next time the game launches.
Just wanted to follow up on this.
I tried profiling with no luck. For some reason any time the profiler is running, the game loads up fast. Maybe that’s a clue?