[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: retain VALUE from C extension

Yukihiro Matsumoto

10/10/2007 5:23:00 PM

Hi,

In message "Re: retain VALUE from C extension"
on Thu, 11 Oct 2007 00:29:47 +0900, "Gaspard Bucher" <gaspard@teti.ch> writes:

|How do I tell ruby to increment it's garbage collector if I want to
|keep hold of a VALUE in a C extension.

I'm not sure what you mean by 'increment' or 'retain', but
rb_global_variable() may be the answer. See README.EXT.

matz.

1 Answer

Gaspard Bucher

10/10/2007 7:02:00 PM

0

Yes, I think this is what I was looking for. As I understand, this
"declares" the address as needing "global marking" by adding it to
global_List.
/* mark protected global variables */
for (list = global_List; list; list = list->next) {
rb_gc_mark_maybe(*list->varptr);
}
>
> I'm not sure what you mean by 'increment' or 'retain', but
> rb_global_variable() may be the answer. See README.EXT.
>
> matz.
>
Effectivelly, "retain" (objective-C terminology) is not appropriate.
From what I understand the mark & sweep garbage collecting process is
quite different from the reference counting strategy I was familiar
with.

Thanks for the information.

Gaspard