Results 1 to 3 of 3

Thread: SDL_TTF - Memory leak when drawing text

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [Solved] SDL_TTF - Memory leak when drawing text

    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!
    Last edited by T-Bear; 02-01-2014 at 11:34 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •