Putting minimal SDL through Valgrind comes up with errors

I’m not sure if I should be ignoring all this:

int main()
{
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
SDL_Quit();
return 0;
}

When run through valgrind

$ valgrind --leak-check=full ./a.out
==19514== Memcheck, a memory error detector
==19514== Copyright © 2002-2012, and GNU GPL’d, by Julian Seward et al.
==19514== Using Valgrind-3.8.0 and LibVEX; rerun with -h for copyright info
==19514== Command: ./jni/src/bin/Debug/BlackDog
==19514==
==19514== Invalid free() / delete / delete[] / realloc()
==19514== at 0x4C2873E: free (vg_replace_malloc.c:446)
==19514== by 0x6038D4A: free_mem (in /lib/libc-2.11.1.so)
==19514== by 0x60388E1: __libc_freeres (in /lib/libc-2.11.1.so)
==19514== by 0x4A226ED: _vgnU_freeres (vg_preloaded.c:62)
==19514== by 0x5F3F214: exit (exit.c:93)
==19514== by 0x5F24C53: (below main) (libc-start.c:258)
==19514== Address 0x404bf30 is not stack’d, malloc’d or (recently) free’d
==19514==
==19514==
==19514== HEAP SUMMARY:
==19514== in use at exit: 28,408 bytes in 399 blocks
==19514== total heap usage: 5,842 allocs, 5,444 frees, 4,306,615 bytes
allocated
==19514==
==19514== 18 bytes in 2 blocks are definitely lost in loss record 8 of 62
==19514== at 0x4C28D3C: malloc (vg_replace_malloc.c:270)
==19514== by 0x8EF9A8B: ??? (in /usr/lib/libX11.so.6.3.0)
==19514== by 0x8EF9D52: _XimSetICValueData (in /usr/lib/libX11.so.6.3.0)
==19514== by 0x8EF2A86: _XimLocalCreateIC (in /usr/lib/libX11.so.6.3.0)
==19514== by 0x8ED6AA2: XCreateIC (in /usr/lib/libX11.so.6.3.0)
==19514== by 0x5535043: SetupWindowData (SDL_x11window.c:109)
==19514== by 0x5535468: X11_CreateWindow (SDL_x11window.c:552)
==19514== by 0x5528DA1: SDL_CreateWindow (SDL_video.c:1180)
==19514== by 0x5528B75: SDL_VideoInit (SDL_video.c:169)
==19514== by 0x54AACF5: SDL_InitSubSystem (SDL.c:55)
==19514== by 0x54AAD53: SDL_Init (SDL.c:150)
==19514== by 0x422DE4: main (main.cpp:33)
==19514==
==19514== 32 bytes in 1 blocks are definitely lost in loss record 14 of 62
==19514== at 0x4C28D3C: malloc (vg_replace_malloc.c:270)
==19514== by 0x533AFB9: ??? (in
/usr/lib/nvidia-current/libGL.so.195.36.24)
==19514== by 0x1C67: ???
==19514== by 0x1F: ???
==19514==
==19514== 32 bytes in 1 blocks are definitely lost in loss record 15 of 62
==19514== at 0x4C28D3C: malloc (vg_replace_malloc.c:270)
==19514== by 0x533AFCE: ??? (in
/usr/lib/nvidia-current/libGL.so.195.36.24)
==19514== by 0x1C67: ???
==19514== by 0x1F: ???
==19514== by 0x1F: ???
==19514== by 0x23: ???
==19514== by 0xC77162F: ???
==19514== by 0xC76F97F: ???
==19514== by 0xC76F90F: ???
==19514== by 0x7FEFFFC1F: ???
==19514== by 0x7FEFFF49F: ???
==19514==
==19514== 32 bytes in 1 blocks are definitely lost in loss record 16 of 62
==19514== at 0x4C28D3C: malloc (vg_replace_malloc.c:270)
==19514== by 0x533AFB9: ??? (in
/usr/lib/nvidia-current/libGL.so.195.36.24)
==19514== by 0x1C67: ???
==19514== by 0x1F: ???
==19514== by 0x1101: ???
==19514== by 0x23: ???
==19514== by 0xCC3674F: ???
==19514== by 0xCC3AB9F: ???
==19514== by 0xCC3AB2F: ???
==19514== by 0x7FEFFFAFF: ???
==19514== by 0x7FEFFF37F: ???
==19514== by 0x1C67: ???
==19514==
==19514== 32 bytes in 1 blocks are definitely lost in loss record 17 of 62
==19514== at 0x4C28D3C: malloc (vg_replace_malloc.c:270)
==19514== by 0x533AFCE: ??? (in
/usr/lib/nvidia-current/libGL.so.195.36.24)
==19514== by 0x1C67: ???
==19514== by 0x1F: ???
==19514== by 0x1F: ???
==19514== by 0x23: ???
==19514== by 0xCC3C84F: ???
==19514== by 0xCC3AB9F: ???
==19514== by 0xCC3AB2F: ???
==19514== by 0x7FEFFFAFF: ???
==19514== by 0x7FEFFF37F: ???
==19514== by 0x1C67: ???
==19514==
==19514== LEAK SUMMARY:
==19514== definitely lost: 146 bytes in 6 blocks
==19514== indirectly lost: 0 bytes in 0 blocks
==19514== possibly lost: 0 bytes in 0 blocks
==19514== still reachable: 28,262 bytes in 393 blocks
==19514== suppressed: 0 bytes in 0 blocks
==19514== Reachable blocks (those to which a pointer was found) are not
shown.
==19514== To see them, rerun with: --leak-check=full --show-reachable=yes
==19514==
==19514== For counts of detected and suppressed errors, rerun with: -v
==19514== ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 4 from 4)

What version (and revision, if HG) of SDL are you using?On Wed, Sep 12, 2012 at 5:44 PM, William Dyce wrote:

I’m not sure if I should be ignoring all this:

int main()
{
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
SDL_Quit();
return 0;
}

When run through valgrind

$ valgrind --leak-check=full ./a.out
==19514== Memcheck, a memory error detector
==19514== Copyright © 2002-2012, and GNU GPL’d, by Julian Seward et al.
==19514== Using Valgrind-3.8.0 and LibVEX; rerun with -h for copyright info
==19514== Command: ./jni/src/bin/Debug/BlackDog
==19514==
==19514== Invalid free() / delete / delete[] / realloc()
==19514== at 0x4C2873E: free (vg_replace_malloc.c:446)
==19514== by 0x6038D4A: free_mem (in /lib/libc-2.11.1.so)
==19514== by 0x60388E1: __libc_freeres (in /lib/libc-2.11.1.so)
==19514== by 0x4A226ED: _vgnU_freeres (vg_preloaded.c:62)
==19514== by 0x5F3F214: exit (exit.c:93)
==19514== by 0x5F24C53: (below main) (libc-start.c:258)
==19514== Address 0x404bf30 is not stack’d, malloc’d or (recently) free’d
==19514==
==19514==
==19514== HEAP SUMMARY:
==19514== in use at exit: 28,408 bytes in 399 blocks
==19514== total heap usage: 5,842 allocs, 5,444 frees, 4,306,615 bytes
allocated
==19514==
==19514== 18 bytes in 2 blocks are definitely lost in loss record 8 of 62
==19514== at 0x4C28D3C: malloc (vg_replace_malloc.c:270)
==19514== by 0x8EF9A8B: ??? (in /usr/lib/libX11.so.6.3.0)
==19514== by 0x8EF9D52: _XimSetICValueData (in /usr/lib/libX11.so.6.3.0)
==19514== by 0x8EF2A86: _XimLocalCreateIC (in /usr/lib/libX11.so.6.3.0)
==19514== by 0x8ED6AA2: XCreateIC (in /usr/lib/libX11.so.6.3.0)
==19514== by 0x5535043: SetupWindowData (SDL_x11window.c:109)
==19514== by 0x5535468: X11_CreateWindow (SDL_x11window.c:552)
==19514== by 0x5528DA1: SDL_CreateWindow (SDL_video.c:1180)
==19514== by 0x5528B75: SDL_VideoInit (SDL_video.c:169)
==19514== by 0x54AACF5: SDL_InitSubSystem (SDL.c:55)
==19514== by 0x54AAD53: SDL_Init (SDL.c:150)
==19514== by 0x422DE4: main (main.cpp:33)
==19514==
==19514== 32 bytes in 1 blocks are definitely lost in loss record 14 of 62
==19514== at 0x4C28D3C: malloc (vg_replace_malloc.c:270)
==19514== by 0x533AFB9: ??? (in
/usr/lib/nvidia-current/libGL.so.195.36.24)
==19514== by 0x1C67: ???
==19514== by 0x1F: ???
==19514==
==19514== 32 bytes in 1 blocks are definitely lost in loss record 15 of 62
==19514== at 0x4C28D3C: malloc (vg_replace_malloc.c:270)
==19514== by 0x533AFCE: ??? (in
/usr/lib/nvidia-current/libGL.so.195.36.24)
==19514== by 0x1C67: ???
==19514== by 0x1F: ???
==19514== by 0x1F: ???
==19514== by 0x23: ???
==19514== by 0xC77162F: ???
==19514== by 0xC76F97F: ???
==19514== by 0xC76F90F: ???
==19514== by 0x7FEFFFC1F: ???
==19514== by 0x7FEFFF49F: ???
==19514==
==19514== 32 bytes in 1 blocks are definitely lost in loss record 16 of 62
==19514== at 0x4C28D3C: malloc (vg_replace_malloc.c:270)
==19514== by 0x533AFB9: ??? (in
/usr/lib/nvidia-current/libGL.so.195.36.24)
==19514== by 0x1C67: ???
==19514== by 0x1F: ???
==19514== by 0x1101: ???
==19514== by 0x23: ???
==19514== by 0xCC3674F: ???
==19514== by 0xCC3AB9F: ???
==19514== by 0xCC3AB2F: ???
==19514== by 0x7FEFFFAFF: ???
==19514== by 0x7FEFFF37F: ???
==19514== by 0x1C67: ???
==19514==
==19514== 32 bytes in 1 blocks are definitely lost in loss record 17 of 62
==19514== at 0x4C28D3C: malloc (vg_replace_malloc.c:270)
==19514== by 0x533AFCE: ??? (in
/usr/lib/nvidia-current/libGL.so.195.36.24)
==19514== by 0x1C67: ???
==19514== by 0x1F: ???
==19514== by 0x1F: ???
==19514== by 0x23: ???
==19514== by 0xCC3C84F: ???
==19514== by 0xCC3AB9F: ???
==19514== by 0xCC3AB2F: ???
==19514== by 0x7FEFFFAFF: ???
==19514== by 0x7FEFFF37F: ???
==19514== by 0x1C67: ???
==19514==
==19514== LEAK SUMMARY:
==19514== definitely lost: 146 bytes in 6 blocks
==19514== indirectly lost: 0 bytes in 0 blocks
==19514== possibly lost: 0 bytes in 0 blocks
==19514== still reachable: 28,262 bytes in 393 blocks
==19514== suppressed: 0 bytes in 0 blocks
==19514== Reachable blocks (those to which a pointer was found) are not
shown.
==19514== To see them, rerun with: --leak-check=full --show-reachable=yes
==19514==
==19514== For counts of detected and suppressed errors, rerun with: -v
==19514== ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 4 from 4)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org