SDL2 using 80% CPU on Mac, 0.1% on Windows

Hi there,

My game written in SDL2 is using 80% (or more) CPU on macOS Mojave, and only 0.1% CPU on Windows 10. If I leave it running for more than a minute on the Mac, the fan runs very fast and the laptop gets hot.

I’m using textures, hardware acceleration, etc and I can’t seem to figure out why it’s using so much CPU instead of doing most of the work on the GPU. I ran it through a profiler and confirmed that most of the CPU time is spent in the SDL_RenderPresent method, which tells me the GPU isn’t being used as much as it should be.

I’m initializing my renderer like this:
m_renderer = SDL_CreateRenderer(m_window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);

Is anyone else experiencing an issue like this or have an idea of what may be going wrong?


Possibly something about vsync not working?
Mojave broke lots of things related to vsync and OpenGL, and maybe the workarounds in SDL2 haven’t been in 2.0.9? You could try building latest SDL2 from hg and see if that’s better
See (you can download the latest source as .zip from

This probably doesn’t help the OP, but the crucial thing is on what MacOS version your app is built, not the version on which it runs. Because of the known problems I build my app with SDL 2.0.9 on High Sierra and I’m reliably informed that vsync works fine when it is run on Mojave.

That actually did fix it. Got it down to around 5.4% CPU usage on average. Still not quite as good as the Windows 10 run, but significantly better.

Hopefully those changes get pushed up into a patch soon.