SDL_VIDEORESIZE & SDL_SetVideoMode memory leak?

I seem to be getting memory leaks when I resize the screen, like when
a SDL_VIDEORESIZE message arrives. (I am using a basically unmodified
version of the sample SDL tutorial program from http://www.meandmark.com/sdlopenglpart1.html.)
Rather than resize the screen a bunch of times, I moved my screen
resize code to be bound to the SDLK_TAB key.

if(event.type==SDL_KEYDOWN && event.key.keysym.sym==SDLK_TAB)
{
SDL_SetVideoMode(640, 480, 0, SDL_OPENGL);
gluOrtho2D(0.0, 4.0, 0.0, 3.0);
}

So I hit this key repeatedly, each time it recreates the new window,
and the window looks fine. And I look in Activity Monitor (I am
programming on a mac by the way) and each time I resize it like this I
use more and more memory. After hitting the key about 30 times, it is
a pretty unwieldy chunk of memory.

Is this a bug? Is there more I should be freeing? I know the OpenGL
context is destroyed with the old window, thus making me do another
gluOrtho2D call. Is there anything I am forgetting to free?

I have read that I don’t have to free the previous screen. Is that
true?
I have even tried calling SDL_FreeSurface(SDL_GetVideoSurface());
before SDL_SetVideoMode, but the memory leak is still there.

Any ideas?

-Trevor Agnitti
www.lackeyccg.com

I’m not sure if this applies, but I’ve been noticing that on Windows, my program gets the new memory that it asks for, but memory that is explicitly freed (hundreds of MBs) is still hanging out in my application’s total memory usage in the Task Manager. When I continue to ask for more memory, eventually my program size drops down to what I expect. Just a note to make sure that it’s a leak rather than the OS waiting to reclaim the memory. Also, SDL automatically frees the display surface when it’s supposed to.

Jonny DDate: Wed, 30 Jul 2008 10:06:05 -0400
From: trevor@lackeyccg.com
To: sdl at lists.libsdl.org
Subject: [SDL] SDL_VIDEORESIZE & SDL_SetVideoMode memory leak?

I seem to be getting memory leaks when I resize the screen, like when a SDL_VIDEORESIZE message arrives. (I am using a basically unmodified version of the sample SDL tutorial program from http://www.meandmark.com/sdlopenglpart1.html.)
Rather than resize the screen a bunch of times, I moved my screen resize code to be bound to the SDLK_TAB key.

if(event.type==SDL_KEYDOWN && event.key.keysym.sym==SDLK_TAB)
{
SDL_SetVideoMode(640, 480, 0, SDL_OPENGL);
gluOrtho2D(0.0, 4.0, 0.0, 3.0);
}

So I hit this key repeatedly, each time it recreates the new window, and the window looks fine. And I look in Activity Monitor (I am programming on a mac by the way) and each time I resize it like this I use more and more memory. After hitting the key about 30 times, it is a pretty unwieldy chunk of memory.

Is this a bug? Is there more I should be freeing? I know the OpenGL context is destroyed with the old window, thus making me do another gluOrtho2D call. Is there anything I am forgetting to free?

I have read that I don’t have to free the previous screen. Is that true?
I have even tried calling SDL_FreeSurface(SDL_GetVideoSurface()); before SDL_SetVideoMode, but the memory leak is still there.

Any ideas?
-Trevor Agnittiwww.lackeyccg.com