Memory leaks in libsdl 1.2.10?

I’m just starting to add libsdl (1.2.10) into my 3D engine and after running
my engine with Compuware’s DevPartner I found a few memory leaks. I have
been reading the libsdl documentation and I don’t think I’m doing anything
wrong. You can see the DevPartner output in
http://www.pablo-zurita.com.ar/gallery/screenshots/sdl_leak?full=1 and the
code I wrote is here:

bool SdlWindow::initialize()
{
if(SDL_Init(SDL_INIT_VIDEO) != 0)
return false;

SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

if(!SDL_SetVideoMode(640, 480, 32, SDL_OPENGL))
    return false;

return true;

}

void SdlWindow::terminate()
{
SDL_QuitSubSystem(SDL_INIT_VIDEO);

SDL_Quit(); //I also tried atexit but the same memory leaks appear.

}

Just if you wonder, I made sure everything both functions get called, that
they get called in the proper order, and that they execute only once. I
didn’t modify libsdl at all; I got the source code from
http://www.libsdl.org/release/SDL-1.2.10.zip and compiled it in Visual
Studio .Net 2005.

I hope you can help me. Thanks in advance.

Pablo Zurita.

Hi.
I tried your code on my pc and it worked just fine. I’m using Dev-Cpp 4.9.9.2 Windows XP.
Try deleting SDL_QuitSubSystem line, I think SDL_Quit terminate all subsystems automatically.

Well, I never said it didn’t work well. It works as expected, the problem is
that memory is being leaked. I called SDL_QuitSubSystem just in case but
with or with it the memory leaks are still there. Thanks anyway.

Pablo Zurita.On 6/19/06, antonmasteR wrote:

Hi.
I tried your code on my pc and it worked just fine. I’m using Dev-Cpp
4.9.9.2 Windows XP.
Try deleting SDL_QuitSubSystem line, I think SDL_Quit terminate all
subsystems automatically.

I’m just starting to add libsdl (1.2.10) into my 3D engine and after running
my engine with Compuware’s DevPartner I found a few memory leaks. I have
been reading the libsdl documentation and I don’t think I’m doing anything
wrong. You can see the DevPartner output in
http://www.pablo-zurita.com.ar/gallery/screenshots/sdl_leak?full=1

Your code is fine, these are just one-time leaks from video initialization.
I’ve entered the bug in SDL’s bug database:
http://bugzilla.libsdl.org/show_bug.cgi?id=255

Thanks!
-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment