Hey guys.
I am currently playing around with SDL and am having a memory leak when rendering some text. I have found out that the code causing the memory leak is the one below. The code is simplified.
Code:
For I:= 0 To High(FElements) Do
begin
Color.r:= 255; Color.g:= 0; Color.b:= 0; // Color is of type TSDL_COLOR.
Tmp:= TTF_RenderText_Blended(FElements[I].Font, 'Some text', Color); // Tmp is a pSDL_SURFACE.
SDL_BLITSURFACE(Tmp, NIL, Screen, Rect); // Rect is a pSDL_RECT.
end;
The problem is that although I know the leak is there (I suspect it is the pSDL_SURFACE), I don't know how to fix it. Any help would be appreciated.
Thanks!
Bookmarks