We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2305 - Memory leaks in SDL2 (Video)
Summary: Memory leaks in SDL2 (Video)
Status: RESOLVED DUPLICATE of bug 2086
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.0
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-14 11:14 UTC by 0.0.0.0
Modified: 2014-02-23 01:28 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 0.0.0.0 2013-12-14 11:14:54 UTC
Valgrind shows many bugs in my game after it's closed, but to narrow the search space I just created a simple test program to show the problem from the beginning.

I use Debian Testing, the SDL2 version is here (currently 2.0.0+dfsg1-3): 
http://packages.qa.debian.org/libs/libsdl2.html


This is the program:
//==================================
#include <SDL2/SDL.h>

int main ( int argc, char **argv )
{
    SDL_Init ( 0 );
    SDL_InitSubSystem ( SDL_INIT_VIDEO );is
    SDL_QuitSubSystem ( SDL_INIT_VIDEO );
    SDL_Quit();
}
//==================================


Then I run: "valgrind --leak-check=full filename"
The output is:
==7832== HEAP SUMMARY:
==7832==     in use at exit: 49,973 bytes in 468 blocks
==7832==   total heap usage: 16,822 allocs, 16,354 frees, 43,124,937 bytes allocated
==7832== 
==7832== 20 bytes in 2 blocks are definitely lost in loss record 7 of 91
==7832==    at 0x4C2935B: malloc (vg_replace_malloc.c:270)
==7832==    by 0x59A5D91: strdup (strdup.c:42)
==7832==    by 0x6683666: ??? (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==7832==    by 0x6684474: _XimSetICValueData (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==7832==    by 0x667FA69: _XimLocalCreateIC (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==7832==    by 0x6666044: XCreateIC (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==7832==    by 0x4ED727A: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.0.0)
==7832==    by 0x4ED7648: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.0.0)
==7832==    by 0x4ECCB84: SDL_CreateWindow (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.0.0)
==7832==    by 0x4ECC98F: SDL_VideoInit (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.0.0)
==7832==    by 0x4E480FE: SDL_InitSubSystem (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.0.0)
==7832==    by 0x4009DF: main (main.cpp:7)
==7832== 
==7832== LEAK SUMMARY:
==7832==    definitely lost: 20 bytes in 2 blocks
==7832==    indirectly lost: 0 bytes in 0 blocks
==7832==      possibly lost: 0 bytes in 0 blocks
==7832==    still reachable: 49,953 bytes in 466 blocks
==7832==         suppressed: 0 bytes in 0 blocks
==7832== Reachable blocks (those to which a pointer was found) are not shown.
==7832== To see them, rerun with: --leak-check=full --show-reachable=yes
==7832== 
==7832== For counts of detected and suppressed errors, rerun with: -v
==7832== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 5 from 3)
Comment 1 0.0.0.0 2013-12-14 11:19:32 UTC
Actually, this is possible a duplicate of bug #2086:
https://bugzilla.libsdl.org/show_bug.cgi?id=2086
Comment 2 0.0.0.0 2013-12-14 11:29:28 UTC
To be honest, Valgrind shows more the 3500 bugs and I don't know where to start with it. Shall I attach a file with the log? There is a small number of my own bugs but it's impossible to browse through such a big list of leaks.
Comment 3 0.0.0.0 2013-12-14 11:54:12 UTC
OK, the rest of leaks is my fault (not destroyed window and renderer) so please consider only my first post.
Sorry
Comment 4 Ryan C. Gordon 2014-02-23 01:28:55 UTC
(In reply to 0.0.0.0 from comment #1)
> Actually, this is possible a duplicate of bug #2086:
> https://bugzilla.libsdl.org/show_bug.cgi?id=2086

Yeah, this is the same issue. Thanks for reporting it, though!

--ryan.

*** This bug has been marked as a duplicate of bug 2086 ***