Base memory usage of SDL2 vs SDL3

Hello!

I’ve been tinkering with SDL2 for a while, made several prototypes and some bigger things as well. I’m working on a puzzle game, but now that SDL3 is mostly ready I was gonna upgrade!

First thing I did was to copy out the template and check out the new method for setting up an app (the callbacks are really neat:)!). What I noticed tho, was that this simple program that did nothing was consuming ~45MB of memory out of the box. The SDL2 game which has both textures, sounds and lots of other game data sits at ~26MB.

They’re using the same compilation options (which include extra stuff like pdb).

I suppose I shouldn’t really worry about having a baseline of 45MB, but I would still like to understand what might cause it to double from SDL2 to SDL3!

Thanks for any insight on this!:smiley:

1 Like

The mostly likely change is that SDL3 uses the GPU renderer by default, which is designed for modern desktop graphics cards and has a higher baseline memory usage. You can add this to your code before SDL_Init() to match SDL2 default behavior and see if that changes:

SDL_SetHint(SDL_HINT_RENDER_DRIVER, "direct3d");
2 Likes

Ah! That was indeed it! This is no problem then, and I’ll happily take that memory consumption for the new 3D features. Thanks for the help!

In SDL2 I used to enumerate the available drivers and then choose one from the list at runtime (although this introduced another issue as I learned I had to set a hint to re-enable batching if I do so).

Would such an approach still be valid in SDL3 with the GPU backend being just one more option in addition to the existing ones?