freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Leaking FT_Glyph_To_Bitmap


From: David Turner
Subject: Re: [Devel] Leaking FT_Glyph_To_Bitmap
Date: Fri, 17 Jan 2003 16:32:24 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2a) Gecko/20020910

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






reply via email to

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