hello guys:
sdl-config --version: 1.2.13
valgrind --version : valgrind-3.2.3
this is a simple test about sdl (sdltest.c):
#include <SDL/SDL.h>
int main(int argc, char* argv[])
{
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO);
SDL_Quit();
}
then i compiled sdltest.c:
gcc -g -o sdltest sdltest.c -lSDL
next, i run it with valgrind:
valgrind --tool=memcheck --leak-check=full --show-reachable=yes
–error-limit=no ./sdltest
then valgrind report some memory leak error:
==19611== 16 bytes in 2 blocks are definitely lost in loss record 9 of 55
==19611== at 0x4005525: malloc (vg_replace_malloc.c:149)
==19611== by 0xA9F882: (within /usr/lib/libX11.so.6.2.0)
==19611== by 0xA9E0D6: (within /usr/lib/libX11.so.6.2.0)
==19611== by 0xA9F063: _XimSetICValueData (in /usr/lib/libX11.so.6.2.0)
==19611== by 0xAA50D0: _XimLocalCreateIC (in /usr/lib/libX11.so.6.2.0)
==19611== by 0xA8CD7B: XCreateIC (in /usr/lib/libX11.so.6.2.0)
==19611== by 0x619E740: create_aux_windows (SDL_x11video.c:515)
==19611== by 0x619F924: X11_VideoInit (SDL_x11video.c:682)
==19611== by 0x618C5AD: SDL_VideoInit (SDL_video.c:240)
==19611== by 0x615F390: SDL_InitSubSystem (SDL.c:70)
==19611== by 0x615F3D6: SDL_Init (SDL.c:162)
==19611== by 0x80484E0: main (sdltest.c:5)
==19611== 224 (16 direct, 208 indirect) bytes in 2 blocks are definitely
lost in loss record 21 of 55
==19611== at 0x4005622: realloc (vg_replace_malloc.c:306)
==19611== by 0xA92B83: (within /usr/lib/libX11.so.6.2.0)
==19611== by 0xA9371B: (within /usr/lib/libX11.so.6.2.0)
==19611== by 0xA95677: _XlcCreateLC (in /usr/lib/libX11.so.6.2.0)
==19611== by 0xAB3AFA: _XlcDefaultLoader (in /usr/lib/libX11.so.6.2.0)
==19611== by 0xA9BFD2: _XOpenLC (in /usr/lib/libX11.so.6.2.0)
==19611== by 0xA9C112: _XlcCurrentLC (in /usr/lib/libX11.so.6.2.0)
==19611== by 0xA9C5C0: XSetLocaleModifiers (in /usr/lib/libX11.so.6.2.0)
==19611== by 0x6194EBD: XSetLocaleModifiers (SDL_x11sym.h:149)
==19611== by 0x619E8E9: create_aux_windows (SDL_x11video.c:468)
==19611== by 0x619F924: X11_VideoInit (SDL_x11video.c:682)
==19611== by 0x618C5AD: SDL_VideoInit (SDL_video.c:240)
now this report made by valgrind is true or false. i have read the
corresponding source code in SDL, maybe there exist some question
that maybe cause memory leak?
so i want to know there is or not some resource allocated by SDL_Init is not
release by SDL_Quit?
thanks.