[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Ruby Extension Code in C, GC Question

Yukihiro Matsumoto

3/3/2008 2:55:00 AM

Hi,

In message "Re: Ruby Extension Code in C, GC Question"
on Mon, 3 Mar 2008 11:19:56 +0900, Pie Squared <PieSquared@gmail.com> writes:

|What happens if you create a new object inside the C code, and this
|triggers a garbage collection?
|When you create new objects in the C code, are they automatically
|added to the 'current' scope, so that the GC sees them? If so, then
|how does it know when to remove them from the scope, and if not, then
|what would happen if a GC cycle was triggered during C code execution?

The object will be marked by Ruby's conservative garbage collector,
which marks objects seemed to be referenced from system stack.

http://en.wikipedia.org/wiki/Garbage_c...(computer_science)#Precise_vs._conservative_and_internal_pointers

matz.

1 Answer

Pie Squared

3/3/2008 3:06:00 AM

0

On Mar 2, 9:54 pm, Yukihiro Matsumoto <m...@ruby-lang.org> wrote:
> Hi,
>
> In message "Re: Ruby Extension Code in C, GC Question"
>     on Mon, 3 Mar 2008 11:19:56 +0900, Pie Squared <PieSqua...@gmail.com> writes:
>
> |What happens if you create a new object inside the C code, and this
> |triggers a garbage collection?
> |When you create new objects in the C code, are they automatically
> |added to the 'current' scope, so that the GC sees them? If so, then
> |how does it know when to remove them from the scope, and if not, then
> |what would happen if a GC cycle was triggered during C code execution?
>
> The object will be marked by Ruby's conservative garbage collector,
> which marks objects seemed to be referenced from system stack.
>
> http://en.wikipedia.org/wiki/Garbage_c...(computer_science)#Pr...
>
>                                                         matz.

Oh! I had missed/misunderstood "conservative" in descriptions of
Ruby's GC...

Well, thanks! (And sorry for asking that question when I _should've_
been able to figure it out myself. :) )