[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft]Some problem about FTC_Cache_RemoveFaceID
From: |
于晨 |
Subject: |
Re: [ft]Some problem about FTC_Cache_RemoveFaceID |
Date: |
Sat, 26 Feb 2011 01:56:49 +0800 (CST) |
Thank you very much for your time in investigating this problem! It's glad to
see there is a conclusion finally, and sorry for not checking this mail until
now :).
--- 11年2月20日,周日, suzuki toshiya <address@hidden> 写道:
> 发件人: suzuki toshiya <address@hidden>
> 主题: Re: [ft]Some problem about FTC_Cache_RemoveFaceID
> 收件人: "于晨" <address@hidden>
> 抄送: "Werner LEMBERG" <address@hidden>, address@hidden
> 日期: 2011年2月20日,周日,下午5:21
> Hi,
>
> Just I've confirmed that the part you found is a bug,
> FTC_Cache_RemoveFaceID() cannot free all of the cache
> nodes
> related with a face with given face ID.
>
> It inflates the footprint of the application in runtime,
> but the leaked memory is freed by FTC_Manager_Done(), so
> it is difficult to be found by SEGV error. I will soon
> update the source code.
>
> I really appreciate your hunting of this subtle bug,
> thank you very much!
>
> Regards,
> mpsuzuki
>
> --
>
> My experiment to confirm this bug is following:
>
> 1) Attached is a patch to extend ftbench to take multiple
> font pathnames from its argument, and execute benchmarks
> for each faces. The faces are cached, and freed when the
> number of cached faces exceeds the limit. The size of
> face cache can be specified by "-M" option, like this.
>
> $ ftbench -M 3 -C a.ttf b.ttf c.ttf d.ttf e.ttf f.ttf g.ttf
> ...
> *** Benchmark with font file a.ttf
> ...
> *** Benchmark with font file b.ttf
> ...
> *** Benchmark with font file c.ttf
> ...
> *** Benchmark with font file d.ttf
> more than max cacheable faces, remove existing cache for
> a.ttf
> ...
>
> 2) By limiting max face cache to 1, and check the cache
> manager before & after FTC_Manager_RemoveFaceID().
>
> Theoretically, all cached objects are related with the
> first
> face, so FTC_Manager_RemoveFaceID() should free all nodes.
> But a node is not freed.
>
> Before
> (gdb) p *manager
> $15 = {library = 0x80e2020,
> memory = 0x80e2008,
> nodes_list = 0x80f7200,
> max_weight = 1048576,
> cur_weight = 42271,
> num_nodes = 103,
> caches = {0x80eb198, 0x80f5aa0,
> 0x80f6f20, 0x0 <repeats 13 times>},
> num_caches = 3,
> faces = {num_nodes = 1, max_nodes = 1,
> ... <=== yes, 1 face is cached
> ...
>
> After
> (gdb) p *manager
> $16 = {library = 0x80e2020,
> memory = 0x80e2008,
> nodes_list = 0x80ef2e8,
> max_weight = 1048576,
> cur_weight = 238,
> num_nodes = 1, <=== oops!
> caches = {0x80eb198, 0x80f5aa0,
> 0x80f6f20, 0x0 <repeats 13 times>},
> num_caches = 3,
> faces = {num_nodes = 0, max_nodes = 1,
> ... <=== yes, no face is cached anymore
> ...
>
> 3) Modifying FTC_Cache_RemoveFaceID's count from
> "cache->p + cache->mask"
> to "cache->p + cache->mask + 1", the last node is
> freed as theoretical
> expect.
>
> After
> (gdb) p *manager
> $2 = {library = 0x80e2020,
> memory = 0x80e2008,
> nodes_list = 0x0,
> max_weight = 1048576,
> cur_weight = 0,
> num_nodes = 0, <== ok!
> caches = {0x80eb198, 0x80f5aa0,
> 0x80f6f20, 0x0 <repeats 13 times>},
> num_caches = 3,
> faces = {num_nodes = 0, max_nodes
> = 1, ...
> ...
>
>
> 于晨 wrote:
> > Thank you very much :)
> >
> > --- 11年1月18日,周二, Werner LEMBERG <address@hidden>
> 写道:
> >
> >> 发件人: Werner LEMBERG <address@hidden>
> >> 主题: Re: [ft]Some problem about
> FTC_Cache_RemoveFaceID
> >> 收件人: address@hidden
> >> 抄送: address@hidden,
> address@hidden
> >> 日期: 2011年1月18日,周二,上午12:34
> >>
> >>>> I found some
> >> strange thing when I used
> >>>>
> >> FTC_Cache_RemoveFaceID() to clear the
> cmap
> >> cache nodes, it
> >>>> seemed that
> there
> >> was a node can't be freed, as the code is:
> >>> I will check, but please wait a few weeks. I'm
> quite
> >> sorry.
> >>
> >> And please do a ping in about a month if nothing
> has
> >> happened :-)
> >>
> >>
> >> Werner
> >>
> >
> >
> >
>
>
> -----下面为附件内容-----
>
>