The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
X11 memory leaks?
foundtimegames


Joined: 30 Jul 2014
Posts: 4
Location: Maine
Hi Folks,

I'm using SDL2 on an ASUS G60V laptop running Ubuntu 13.04. The laptop has an nvidia geforce gtx video card. I know it's old, but it's what I have for a computer right now.

I'm having a memory leak issue, according to valgrind. I made a test application to attempt to isolate the problem, and I have put the source, makefile, and valgrind output into a tar file that is here: http://foundtimegames.com/sdl_x11_bug.tar

The closest discovered bug that I found so far was this: http://lists.libsdl.org/pipermail/sdl-libsdl.org/2013-October/091448.html but I am running SDL 2.0.3, and from what I understand that bug was fixed.

The main issue seems to be here:
==6081== 132 bytes in 4 blocks are definitely lost in loss record 90 of 136
==6081== at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6081== by 0x6F87340: XGetWindowProperty (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==6081== by 0x4F02AFE: X11_DispatchEvent (SDL_x11events.c:572)
==6081== by 0x4F035C9: X11_PumpEvents (SDL_x11events.c:1017)
==6081== by 0x4E812E6: SDL_PollEvent_REAL (SDL_events.c:402)
==6081== by 0x40111D: main (test.cpp:4Cool

Although I also get consistent definite memory loss here:
==6081== 35 bytes in 1 blocks are definitely lost in loss record 28 of 136
==6081== at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6081== by 0x7FBF4EC: ??? (in /usr/lib/nvidia-304/libGL.so.304.8Cool
==6081== by 0x6A732F656D6F682E: ???
==6081== by 0x61672F736C6C696F: ???
==6081== by 0x64732F766564656C: ???
==6081== by 0x65742F747365746B: ???
==6081== by 0x7FEFF7472: ???
==6081== by 0x5E9C9CC: __sprintf_chk (sprintf_chk.c:32)
==6081== by 0x6FB4DA6: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==6081== by 0x4F2026B: ??? (in /usr/local/lib/libSDL2-2.0.so.0.2.1)
==6081== by 0x780000101: ???
==6081== by 0x4F07550: X11_GL_LoadLibrary (SDL_x11opengl.c:157)

And here:
==6081== 10 bytes in 2 blocks are definitely lost in loss record 8 of 136
==6081== at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6081== by 0x5E168D1: strdup (strdup.c:42)
==6081== by 0x6FCB315: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==6081== by 0x6FCC254: _XimSetICValueData (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==6081== by 0x6FC787D: _XimLocalCreateIC (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==6081== by 0x6FADCE2: XCreateIC (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==6081== by 0x4F0A51A: SetupWindowData (SDL_x11window.c:240)
==6081== by 0x4F0A950: X11_CreateWindow (SDL_x11window.c:553)
==6081== by 0x4EF31ED: SDL_CreateWindow_REAL (SDL_video.c:1292)
==6081== by 0x4EF2E1F: SDL_VideoInit_REAL (SDL_video.c:192)
==6081== by 0x4E4A3EE: SDL_InitSubSystem_REAL (SDL.c:173)
==6081== by 0x401030: main (test.cpp:20)
==6081==
==6081== 10 bytes in 2 blocks are definitely lost in loss record 9 of 136
==6081== at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6081== by 0x5E168D1: strdup (strdup.c:42)
==6081== by 0x6FCB315: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==6081== by 0x6FCC254: _XimSetICValueData (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==6081== by 0x6FC787D: _XimLocalCreateIC (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==6081== by 0x6FADCE2: XCreateIC (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==6081== by 0x4F0A51A: SetupWindowData (SDL_x11window.c:240)
==6081== by 0x4F0A950: X11_CreateWindow (SDL_x11window.c:553)
==6081== by 0x4EEF35C: SDL_RecreateWindow (SDL_video.c:1391)
==6081== by 0x4E99453: GL_CreateRenderer (SDL_render_gl.c:404)
==6081== by 0x4E91149: SDL_CreateRenderer_REAL (SDL_render.c:272)
==6081== by 0x4EED733: SDL_CreateWindowTexture (SDL_video.c:260)


Any thoughts? Is my PC the problem? Is there something I can do?
-Seth