[SDL] SDL_ttf memory leak

Eike Umlauf e9726056 at student.tuwien.ac.at
Thu Feb 7 22:42:01 PST 2002


hi

i've just experimented a bit with the SDL_ttf 2.0.4 library, but when i
fired up the win2k task manager while running my prog, i discovered it
continued to allocate more RAM and never freed it.

when i comment the following block, the memory usage stays constant.


SDL_Rect dstrect;
SDL_Color forecol;
forecol.r = 0; forecol.g=0; forecol.b = 0;

SDL_Surface *text = TTF_RenderText_Solid(arial, "Hello world!!",
forecol);
if(text != NULL) 
{
	dstrect.x = 400;
	dstrect.y = i++;
	dstrect.w = text->w;
	dstrect.h = text->h;
	SDL_BlitSurface(text, NULL, screen, &dstrect);
	SDL_UpdateRect(screen,400,i-2,text->w,text->h);
	SDL_FreeSurface(text);
}

that's it. leaks about 16KB per second i'd say.
has anyone encountered this before? is it a bug in SDL_ttf or in the
Freetype library? most importantly, is there a fix?

thx
eik




More information about the SDL mailing list