Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > retain VALUE from C extension

Reply
Thread Tools

retain VALUE from C extension

 
 
Gaspard Bucher
Guest
Posts: n/a
 
      10-10-2007
How do I tell ruby to increment it's garbage collector if I want to
keep hold of a VALUE in a C extension.

example:

VALUE message;

static VALUE store_message(VALUE self, VALUE msg) {
// tell ruby to retain....
// rb_retain(msg) ?
message = msg;
return Qnil;
}

 
Reply With Quote
 
 
 
 
Gaspard Bucher
Guest
Posts: n/a
 
      10-10-2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FileUpload control not able to retain its value Harinath ASP .Net 1 12-22-2006 12:09 PM
Variable retain value between case statements alacrite@gmail.com C++ 5 10-06-2006 05:51 PM
dropdownlist does not retain its selectedindex value on postback. John Blair ASP .Net 2 08-02-2005 10:03 PM
Returning a value and retain the original values velthuijsen@hotmail.com C++ 8 06-28-2005 08:32 AM
Page Post Back -- how to retain selecteditem.value of TWO dropdowns??? KathyB ASP .Net 6 06-27-2003 03:33 PM



Advertisments