From: Eric Wong Date: 2014-08-03T22:48:54+00:00 Subject: [ruby-core:64178] Re: [ruby-trunk - Feature #9894] [Open] [RFC] README.EXT: document rb_gc_register_mark_object I tried making rb_gc_register_address work transparently but wasn't able to measure any difference with unicorn. unicorn uses a few global const strings for common HTTP headers, but maybe not enough to matter for this patch. This patch is probably pointless, but in case somebody else wants to try and show it makes a difference, it is here: --- a/gc.c +++ b/gc.c @@ -5154,13 +5154,15 @@ rb_gc_register_mark_object(VALUE obj) void rb_gc_register_address(VALUE *addr) { - rb_objspace_t *objspace = &rb_objspace; - struct gc_list *tmp; - - tmp = ALLOC(struct gc_list); - tmp->next = global_list; - tmp->varptr = addr; - global_list = tmp; + if (OBJ_FROZEN(*addr)) { + rb_gc_register_mark_object(*addr); + } else { + rb_objspace_t *objspace = &rb_objspace; + struct gc_list *tmp = ALLOC(struct gc_list); + tmp->next = global_list; + tmp->varptr = addr; + global_list = tmp; + } } void