相关疑难解决方法(0)

为什么valgrind说基本的SDL程序正在泄漏内存?

这是SDL计划:

#include <SDL/SDL.h>

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


  SDL_Init(SDL_INIT_VIDEO);
  SDL_Surface* screen = SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE);
  SDL_Quit();
  return 0;

}
Run Code Online (Sandbox Code Playgroud)

用命令编译:

g++ -o test test.cpp -lSDL
Run Code Online (Sandbox Code Playgroud)

这是valgrind的输出:

christian@christian-laptop:~/cpp/tetris$ valgrind --leak-check=full ./test
==3271== Memcheck, a memory error detector
==3271== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==3271== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for copyright info
==3271== Command: ./test
==3271== 
==3271== 
==3271== HEAP SUMMARY:
==3271==     in use at exit: 91,097 bytes in 1,258 blocks
==3271==   total …
Run Code Online (Sandbox Code Playgroud)

c++ valgrind sdl

22
推荐指数
2
解决办法
9882
查看次数

标签 统计

c++ ×1

sdl ×1

valgrind ×1