[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ft] Cache manager/glyph copy memory leak problem
From: |
Ric Flinn |
Subject: |
[ft] Cache manager/glyph copy memory leak problem |
Date: |
Wed, 16 Jan 2008 10:37:16 -0800 (PST) |
Hello,
Can somebody help me with a memory leak issue that I'm having when I use
FTC_ImageCache_Lookup() and FT_Glyph_Copy()?
I'm using FT_Glyph caching, which by itself is working fine for me. In certain
cases I need to perform a transform operation on a glyph, so I'm using
FT_Glyph_Copy() to get a copy of the glyph to transform. In these cases, I see
memory leaks; I have enabled FT2_DEBUG_MEMORY and it confirms that I'm leaking
memory.
Here's the relevant parts of the code:
font_type.face_id = (FTC_FaceID)face_id;
font_type.width = (short) typeface->scale.width;
font_type.height = (short) typeface->scale.height;
font_type.flags = FT_LOAD_DEFAULT;
ft_error = FTC_ImageCache_Lookup(
imagecache,
&font_type,
glyph_index,
&ftc_glyph,
NULL
);
glyph_ptr = &ftc_glyph;
if (transform)
{
FT_Glyph tmp_glyph;
ft_error = FT_Glyph_Copy(ftc_glyph, &tmp_glyph);
(void)FT_Glyph_Transform(tmp_glyph, &ft_matrix, NULL);
glyph_ptr = &tmp_glyph;
}
/* Convert the glyph to a bitmap */
ft_error = FT_Glyph_To_Bitmap(glyph_ptr, FT_RENDER_MODE_NORMAL, NULL, 0);
/* Draw the bitmap, etc.
...
*/
/* Release the bitmap */
FT_Done_Glyph(*glyph_ptr);
If "transform" is false, no memory problem occurs, but if it is true, the code
loses some memory. I'm using version 2.3.5, and I've tried this on both Linux
and Windows. Here's the leak info from the memory debugger, from drawing a
single transformed glyph:
leaked memory block at address 02AE0818, size 4 in
(c:\freetype-2.3.5\src\base\ftoutln.c:271)
leaked memory block at address 02ADCB78, size 40 in
(..\..\..\src\base\ftglyph.c:355)
leaked memory block at address 02ADAED0, size 160 in
(c:\freetype-2.3.5\src\base\ftoutln.c:269)
leaked memory block at address 02ADAFE8, size 10 in
(c:\freetype-2.3.5\src\base\ftoutln.c:270)
FreeType: total memory allocations = 1559203
FreeType: maximum memory footprint = 308981
FreeType.Debug: FreeType: 214 bytes of memory leaked in 4 blocks
Any help would be much appreciated.
- Ric
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
- [ft] Cache manager/glyph copy memory leak problem,
Ric Flinn <=