Why does valgrind say basic SDL program is leaking memory?

前端 未结 5 474
星月不相逢
星月不相逢 2020-12-01 12:00

Here is the SDL program:

#include 

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


  SDL_Init(SDL_INIT_VIDEO);
  SDL_Surface* screen = SDL_SetVideoMode(         


        
5条回答
  •  自闭症患者
    2020-12-01 12:46

    Even for basic OpenGL "hello world" program without the full SDL, Valgrind gives me similar warnings deep inside the OpenGL libraries. It's peculiar, but I've assumed

    • The library implementors know what they're doing (probably preallocating some small static buffers they never bother to free),
    • Even if they don't, it's a one-time leak that'll be reclaimed by the OS when the program terminates,

    and haven't lost much sleep over it.

提交回复
热议问题