[hellogcc] Re: [hellogcc] Re: [hellogcc] Re: [hellogcc] Re: [hellogcc] Re: [hellogcc] Re: [hellogcc] 哪位大牛能简单介绍一下GCC里面的垃圾收集功能

  • From: Liu <proljc@xxxxxxxxx>
  • To: hellogcc@xxxxxxxxxxxxx
  • Date: Thu, 30 Jun 2011 10:45:29 +0800

2011/6/29 asmwarrior <asmwarrior@xxxxxxxxx>:
> On 2011-6-28 20:29, Mingjie Xing wrote:
>>
>> 在 2011年6月28日 下午3:29,Yao Qi<qiyaoltc@xxxxxxxxx>  写道:
>>>
>>> 关于mark-and-sweep,是标准的GC算法,也可能是最初级的吧。这个不是问题。
>>>
>>> 问题是:
>>> 哪里有显示调用垃圾搜集?
>>
>> 搜索源码 ggc_ 可以发现有许多地方显式调用了ggc_开头的函数。其中ggc_free函数,看起来应该是做垃圾搜集的。
>>
>>> 为啥用GTY标记,就能成为root?
>>
>> 这就涉及到了root集的定义。龙书上如是说:"我们把所有不需要对任何指针解引用就可以被程序直接访问的数据称为根集(root set)"。
>>
>> gcc internals里如是说:
>>
>> In addition to keeping track of types, the type machinery also locates
>> the global variables (roots) that the garbage collector starts at.
>> Roots must be declared using one of the following syntaxes:
>>
>>     * extern GTY(([options])) type name;
>>     * static GTY(([options])) type name;
>>
>> xmj
>
> 你们说的越来越专业了,龙书我还没有完整看过,呵呵,只看到前面的parser部分。
>
>

http://gcc.gnu.org/onlinedocs/gccint/GTY-Options.html

不专业,就是这个,知道怎么用就行了。
可以认为是一种C扩展语法,挺好的。

Other related posts:

  • » [hellogcc] Re: [hellogcc] Re: [hellogcc] Re: [hellogcc] Re: [hellogcc] Re: [hellogcc] Re: [hellogcc] 哪位大牛能简单介绍一下GCC里面的垃圾收集功能 - Liu