freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: [Devel] Leaking FT_Glyph_To_Bitmap


From: Patrick Hoffmann
Subject: AW: [Devel] Leaking FT_Glyph_To_Bitmap
Date: Sat, 18 Jan 2003 11:03:21 +0100

I do call FT_Done_Glyph() (later in my code) and it works mostly fine.
Except the struct created by FT_Glyph_To_Bitmap! I have to delete it
manually before calling FT_Done_Glyph().

-----Ursprüngliche Nachricht-----
Von: address@hidden [mailto:address@hidden Im
Auftrag von David Turner
Gesendet: Freitag, 17. Januar 2003 16:32
An: address@hidden
Betreff: Re: [Devel] Leaking FT_Glyph_To_Bitmap


Hello Patrick,

Patrick Hoffmann wrote:
> Hi freetype folx...
> 
> I found a leak (or a misktake of myself ;) in FreeType 2.
> 
> When I user FT_Glyph_To_Bitmap() I need to delete the bitmap buffer 
> and the bitmap it self by my own. I didn't found any hint about that 
> in the documentation, so I think this might be a memory leak bug.
> 
> Any ideas?
>
FT_Glyph objects are not monitored by the library, you need to destroy
them yourself (unlike FT_Size/FT_GlyphSlot/FT_CharMap objects which are
automatically destroyed when FT_Done_Face or FT_Done_FreeType are
called)

When FT_Glyph_To_Bitmap is called, it really creates a new FT_Glyph
object and changes your "image" handle to point to it. you should call
FT_Done_Glyph to destroy it when you don't need it anymore..

I don't think this is a memory leak, just normal behaviour for the
library...

Hope this helps,

- David Turner
- The FreeType Project  (www.freetype.org)


> Here is the code...
> 
>       FT_Glyph        image = it->m_ftglyph;
> 
>       e = FT_Glyph_To_Bitmap( &image, ft_render_mode_normal, &pen, 0
> );
>       if( !e )
>       {
>               FT_BitmapGlyph  bit = (FT_BitmapGlyph)image;
> 
>               Driver_Display_Bitmap( ... );
> 
>               // Undocumented: must delete these both...
>               delete [] bit->bitmap.buffer;
>               delete bit;
>       }
> 
> 
> _______________________________________________
> Devel mailing list
> address@hidden http://www.freetype.org/mailman/listinfo/devel
> 



_______________________________________________
Devel mailing list
address@hidden http://www.freetype.org/mailman/listinfo/devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]