From: Carter Cheng Date: 2011-10-20T10:44:51+09:00 Subject: [ruby-core:40240] Re: invoking garbage_collect in gc.c --20cf3079ba68139a3d04afb11aa9 Content-Type: text/plain; charset=ISO-8859-1 I do not see the position from which gc_sweep or gc_lazy_sweep is called in the code(I did a preliminary search using grep). I would appreciate it if you could point me to the location where the gc is triggered according to the condition you just mentioned. On Thu, Oct 20, 2011 at 12:23 PM, Carter Cheng wrote: > Thanks Nari. > > On Thu, Oct 20, 2011 at 11:52 AM, Narihiro Nakamura wrote: > >> Hi, >> >> > Hello, >> > >> > I hope people do not mind that I have a followup question- >> > >> > from where is the garbage collector invoked in the interpreter? >> >> Let me talk about trunk's GC because CRuby's GC adopts Lasy Sweep GC >> since Ruby 1.9.3. >> >> In many case, GC is invoked at following cases. >> >> 1. When the interpreter allocate some Ruby's object. >> 2. When you call GC.start in your Ruby programs. >> 3. When malloc_increase exceeds malloc_limit. >> >> In 2. and 3. cases, GC executs mark and sweep atomically by using >> garbage_collect() in gc.c. >> >> In 1. and Ruby's heap don't have a unswept object cases, GC executs >> mark and sweep that sweeps Ruby's heap until it finds an appropriate >> free object. >> >> In 1. and Ruby's heap has a unswept object cases, GC executs sweep >> until it finds an appropriate free object. >> >> Please see gc_lazy_sweep() in gc.c if you want to know a detail of >> this process. >> >> # And, you can see matt's great presentation for this topic. >> # http://rubyconf11.merbist.com/#57 >> >> Thanks. >> -- >> Narihiro Nakamura (nari) >> >> > --20cf3079ba68139a3d04afb11aa9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I do not see the position from which gc_sweep or gc_lazy_sweep is called in= the code(I did a preliminary search using grep). I would appreciate it if = you could point me to the location where the gc is triggered according to t= he condition you just mentioned.

On Thu, Oct 20, 2011 at 12:23 PM, Carter Che= ng <carterche= ng@gmail.com> wrote:
Thanks Nari.

On Thu, Oc= t 20, 2011 at 11:52 AM, Narihiro Nakamura <authornari@gmail.com>= wrote:
Hi,

> Hello,
>
> I hope people do not mind that I have a followup question-
>
> from where is the garbage collector invoked in the interpreter?

Let me talk about trunk's GC because CRuby's GC adopts Lasy S= weep GC
since Ruby 1.9.3.

In many case, GC is invoked at following cases.

1. When the interpreter allocate some Ruby's object.
2. When you call GC.start in your Ruby programs.
3. When malloc_increase exceeds malloc_limit.

In 2. and 3. cases, GC executs mark and sweep atomically by using
garbage_collect() in gc.c.

In 1. and Ruby's heap don't have a unswept object cases, GC executs=
mark and sweep that sweeps Ruby's heap until it finds an appropriate free object.

In 1. and Ruby's heap has a unswept object cases, GC executs sweep
until it finds an appropriate free object.

Please see gc_lazy_sweep() in gc.c if you want to know a detail of
this process.

# And, you can see matt's great presentation for this topic.
# http://ru= byconf11.merbist.com/#57

Thanks.
--
Narihiro Nakamura (nari)



--20cf3079ba68139a3d04afb11aa9--