Hi,
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",
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 600, 400, SDL_WINDOW_SHOWN);
if (pWindow != NULL){
SDL_Renderer * pRenderer = SDL_CreateRenderer(pWindow, -1, SDL_RENDERER_ACCELERATED);
while (1){
SDL_RenderClear(pRenderer);
SDL_RenderPresent(pRenderer);
}
SDL_DestroyRenderer(pRenderer);
SDL_DestroyWindow(pWindow);
SDL_Quit();
return EXIT_SUCCESS;
}
}
return EXIT_FAILURE;
}
And my arguments vscode of compilation C :
"args": [
"-fdiagnostics-color=always",
"-Wall",
"-O3",
"-I/usr/include/SDL2",
"-D_REENTRANT",
"-L/usr/lib",
"-Wl,-rpath,/usr/lib",
"-Wl,--enable-new-dtags",
"-pthread",
"-lSDL2",
"-lSDL2_ttf",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
My OS : Linux Manjaro
Thank you for your ideas … I imagine that for a lib like SDL this is not normal!