Big memory problem, growing increase !


I am very surprised to realize that with just the basic skeleton of a C program with SDL, my application devours 5MB RAM every 1 second.
So after a few minutes my RAM is FULL

Where is the problem ?

For the test, no control on function returns, no waiting for an event, but my window works fine!
(I kick it with vscode), here is my code, the minimum :

#include <SDL.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv){

    if (!SDL_Init(SDL_INIT_VIDEO)){

        SDL_Window * pWindow = SDL_CreateWindow("Linux SDL",

        if (pWindow != NULL){
            SDL_Renderer * pRenderer = SDL_CreateRenderer(pWindow, -1, SDL_RENDERER_ACCELERATED);

            while (1){



            return EXIT_SUCCESS;

    return EXIT_FAILURE;

And my arguments vscode of compilation C :

"args": [


My OS : Linux Manjaro

Thank you for your ideas … I imagine that for a lib like SDL this is not normal! :slight_smile:

I don’t know, but there’s nothing to limit the speed at which it runs the rendering loop so it’s an entirely unrealistic situation. What happens if you specify SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC in the SDL_CreateRenderer() flags?

Oh very nice ! It works !

I just add SDL_RENDERER_PRESENTVSYNC and the memory is stabilized !

I don’t understand this parameter is vague ind the documentation. Why this and not another ?

Synchronizes rendering with refresh rate. The refresh rate is the number of times the screen is updated per second. Thus, the rendering will be synchronized with it.

Thank you @rtrussell