I’m kind of a beginner 'round these parts, and I was following a tutorial about getting the keyboard state. In the documentation for SDL_GetKeyboardState(), it is mentioned that:
The pointer returned is a pointer to an internal SDL array. It will be valid for the whole lifetime of the application and should not be freed by the caller.
If that’s true, wouldn’t calling SDL_GetKeyboardState every frame to check for input quickly bloat up the heap? In a 60 FPS game, getting a 512 byte response every frame would result in 30 kilobytes per second, almost two megabytes per minute, that’s adds up quick!
So there’s no way it works the way I think it does, right?
Am I missing some optimisation magic in the background here that makes it work, or just interpreting the documentation wrong? Maybe it’s only tracking the differences in keyboard state? Even then, however, I’d imagine mashing the keyboard for a while would add a lot of memory to the heap as well.