freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] memory leak


From: Emmanuel BOUAZIZ
Subject: [ft-devel] memory leak
Date: Mon, 04 Aug 2008 16:29:49 +0200
User-agent: Thunderbird 2.0.0.16 (X11/20080724)

Hello,

I'm trying to use freetype2 under eCos.

I followed the tutorial (step 2) and am using kerning and glyph metrics for centering. The rendering works well in both normal and mono modes :)

But when I activated the FT_DEBUG_MEMORY mode to get an idea an the memory footprint, it reported memory leaks.

I started back from the begining, adding steps one by one to find the one responsible for the reported leak (always finishing with (FT_Done_Glyph), FT_Done_Face and FT_Done_FreeType).

FT_Init_FreeType
FT_New_Face
FT_Set_Char_Size
FT_HAS_KERNING
FT_Get_Char_Index
FT_Get_Kerning
FT_Load_Glyph
FT_Get_Glyph
FT_Glyph_Get_CBox
FT_Glyph_To_Bitmap

FT_Done_Glyph
FT_Done_Face
FT_Done_FreeType

and it happens when I add the FT_Glyph_To_Bitmap() step, mono mode or normal mode does not change anything.

When I render only one caracter, I get the following report :

FreeType Memory Dump: current=233 max=54889 total=70939 count=4
block  block    sizes    sizes    sizes   source
count   high      sum  highsum      max   location
-------------------------------------------------
     0      1        0    16384    16384 src/ftobjs.c:3933
     0      1        0    14908    14908 src/ttpload.c:108
     0      1        0    14896    14896 src/ttmtx.c:180
     0      1        0    14888    14888 src/ttmtx.c:176
     0      1        0     2526     2526 src/ttload.c:841
     0      1        0      828      828 src/ftobjs.c:1045
     0      1        0      616      616 src/ttinterp.c:786
     0      1        0      512      512 src/ftgloadr.c:228
     0      1        0      512      512 src/ttinterp.c:459
     0      1        0      480      480 src/ttload.c:728
     0      1        0      384      384 src/ttinterp.c:524
     0      1        0      342      342 src/ftsmooth.c:206
     0      2        0      320      308 src/ftobjs.c:2070
     0      1        0      288      288 src/ttload.c:729
     0      1        0      256      256 src/ttload.c:323
     0      1        0      256      256 src/ttload.c:319
     0      1        0      256      256 src/ftgloadr.c:221
     0      4        0      248       84 src/ftobjs.c:3687
     0      1        0      196      196 src/ftobjs.c:3925
     0      2        0      192       96 src/ftgloadr.c:76
     1      1      168      168      168 src/ftoutln.c:269
     0      1        0      160      160 src/ftobjs.c:372
     0      3        0      136       56 src/ftobjs.c:2807
     1      2       40       92       52 src/ftglyph.c:355
     0      1        0       78       78 <unknown>:0
     0      1        0       76       76 src/ttgload.c:188
     0      1        0       56       56 src/ftobjs.c:1048
     0      1        0       40       40 src/ftobjs.c:140
     0      1        0       40       40 src/ftobjs.c:228
     0      1        0       32       32 src/ttobjs.c:130
     0      1        0       32       32 src/ftgloadr.c:222
     0      1        0       32       32 src/ttobjs.c:129
     0      1        0       32       32 src/ttobjs.c:128
     0      2        0       28       16 src/sfobjs.c:265
     0      2        0       24       12 src/ftobjs.c:3372
     0      1        0       24       24 src/ftraster.c:3235
     1      1       21       21       21 src/ftoutln.c:270
     0      1        0       20       20 src/ftgrays.c:1917
     0      1        0       16       16 src/ttobjs.c:618
     0      2        0       16        9 src/sfobjs.c:60
     0      1        0       12       12 src/ftobjs.c:1846
     0      1        0       12       12 src/ftobjs.c:2822
     0      1        0        8        8 src/ttobjs.c:620
     0      1        0        8        8 src/ttmtx.c:177
     0      1        0        8        8 src/ftgloadr.c:249
     0      1        0        4        4 src/ttpload.c:230
     0      1        0        4        4 src/ttload.c:1162
     0      1        0        4        4 src/ttload.c:1142
     0      1        0        4        4 src/ttload.c:1161
     0      1        0        4        4 src/ttpload.c:233
     0      1        0        4        4 src/sfobjs.c:404
     1      1        4        4        4 src/ftoutln.c:271
     0      1        0        4        4 src/ttobjs.c:131
     0      1        0        4        4 src/ttobjs.c:621
------------------------------------------------
leaked memory block at address 0x8040a818, size       21
in (src/ftoutln.c:270)
leaked memory block at address 0x8040a888, size        4
in (src/ftoutln.c:271)
leaked memory block at address 0x8040a698, size       40
in (src/ftglyph.c:355)
leaked memory block at address 0x8040a718, size      168
in (src/ftoutln.c:269)
FreeType: total memory allocations = 70939
FreeType: maximum memory footprint = 54889
FreeType: 233 bytes of memory leaked in 4 blocks

When i render a whole string, the block count on the ftglyph.c line is equal to the number of caracters of the string and the block count on the ftoutln.c lines are equal to the non-whitespace caracters of the string.

I'm using freetype 2.3.6. I know 2.3.7 is released but I can't update this week.
The font is the FreeSans.ttf truetype font shipped with ubuntu.

I'm compiling these files :
       src/ftbase.c
       src/ftdebug.c
       src/ftinit.c
       src/ftsystem.c
       src/ftbbox.c
       src/ftglyph.c
       src/ftbitmap.c
       src/raster.c
       src/smooth.c
       src/sfnt.c
       src/truetype.c

and enabled these modules
       tt_driver_class
       ft_raster1_renderer_class
       sfnt_module_class
       ft_smooth_renderer_class

Did I miss something ?
Thanks for your help.

regards,
Emmanuel




reply via email to

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