Whenever I lose focus from my game window, I go from ~60FPS to 6000+, then when the window gains focus again, I go back to around 60 frames per second. And yes, this happens every time I run my game, including Release mode.
Here is an example log output from my game:
[INFO] [10/01/2013 22:37:42.355] Window Gained Focus!
[INFO] [10/01/2013 22:37:45.365] Frames Per Second: 60.0439
[INFO] [10/01/2013 22:37:45.365] Frame Counter: 60
[INFO] [10/01/2013 22:37:46.365] Frames Per Second: 60.0324
[INFO] [10/01/2013 22:37:46.365] Frame Counter: 60
[INFO] [10/01/2013 22:37:47.381] Frames Per Second: 59.4341
[INFO] [10/01/2013 22:37:47.382] Frame Counter: 58
[INFO] [10/01/2013 22:37:49.669] Window Lost Focus!
[INFO] [10/01/2013 22:37:50.383] Frames Per Second: 1240.02
[INFO] [10/01/2013 22:37:50.383] Frame Counter: 9561
[INFO] [10/01/2013 22:37:51.384] Frames Per Second: 1839.02
[INFO] [10/01/2013 22:37:51.384] Frame Counter: 6662
[INFO] [10/01/2013 22:37:52.77] Window Gained Focus!
[INFO] [10/01/2013 22:37:52.400] Frames Per Second: 1656.77
[INFO] [10/01/2013 22:37:52.400] Frame Counter: 34
[INFO] [10/01/2013 22:37:53.400] Frames Per Second: 1512.46
[INFO] [10/01/2013 22:37:53.400] Frame Counter: 60
[INFO] [10/01/2013 22:37:54.401] Frames Per Second: 1391.89
[INFO] [10/01/2013 22:37:54.402] Frame Counter: 60
[INFO] [10/01/2013 22:37:55.402] Frames Per Second: 1289.78
[INFO] [10/01/2013 22:37:55.402] Frame Counter: 58
[INFO] [10/01/2013 22:37:55.876] Quitting with error code: 0
The frame counter is just a simple integer that I increment every loop in the game, and then reset (and print it out) every second. Here is the implementation of my game loop, (inside the run() function), based off of this article.
Is this a problem with my loop, or is this a problem with SDL? I'm not sure why my frame rate is rocketing up.