Issue #5199 has been reported by Eric Wong. ---------------------------------------- Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places http://redmine.ruby-lang.org/issues/5199 Author: Eric Wong Status: Open Priority: Normal Assignee: Category: ext Target version: 1.9.x ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux] I noticed the following in ext/tk/tkutil/tkutil.c: rb_warning("fail to convert '%s' to string for Tk", RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0, 0))); id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str))); I don't use or know the Tk ext at all, but the above examples do not appear safe from a GC perspective. Compilers can optimize the original VALUE away entirely so GC can collect. RSTRING_PTR (being a macro,) may also evaluate its arguments multiple times.
on 2011-08-17 04:32
on 2011-08-18 08:55
Issue #5199 has been updated by Kenta Murata. Assignee set to Hidetoshi Nagai ---------------------------------------- Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places http://redmine.ruby-lang.org/issues/5199 Author: Eric Wong Status: Open Priority: Normal Assignee: Hidetoshi Nagai Category: ext Target version: 1.9.x ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux] I noticed the following in ext/tk/tkutil/tkutil.c: rb_warning("fail to convert '%s' to string for Tk", RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0, 0))); id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str))); I don't use or know the Tk ext at all, but the above examples do not appear safe from a GC perspective. Compilers can optimize the original VALUE away entirely so GC can collect. RSTRING_PTR (being a macro,) may also evaluate its arguments multiple times.
on 2013-02-17 11:07
Issue #5199 has been updated by ko1 (Koichi Sasada). Target version changed from 2.0.0 to 2.1.0 Time up for 2.0.0. Nagai-san, how about it? ---------------------------------------- Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places https://bugs.ruby-lang.org/issues/5199#change-36417 Author: normalperson (Eric Wong) Status: Assigned Priority: Normal Assignee: nagai (Hidetoshi Nagai) Category: ext Target version: 2.1.0 ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux] I noticed the following in ext/tk/tkutil/tkutil.c: rb_warning("fail to convert '%s' to string for Tk", RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0, 0))); id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str))); I don't use or know the Tk ext at all, but the above examples do not appear safe from a GC perspective. Compilers can optimize the original VALUE away entirely so GC can collect. RSTRING_PTR (being a macro,) may also evaluate its arguments multiple times.
on 2013-02-18 05:54
From: "ko1 (Koichi Sasada)" <redmine@ruby-lang.org> Subject: [ruby-core:52367] [ruby-trunk - Bug #5199] ext/tk: RB_GC_GUARD seems to be needed in several places Date: Sun, 17 Feb 2013 19:06:43 +0900 Message-ID: <redmine.journal-36417.20130217190643@ruby-lang.org> > Issue #5199 has been updated by ko1 (Koichi Sasada). > > Target version changed from 2.0.0 to 2.1.0 > > Time up for 2.0.0. > > Nagai-san, how about it? I'm very sorry. I didn't check the tickets about Ruby/Tk. Last half year (and now), I was busy on my primary works. So I couldn't follow up many changes for 2.0.0. I'll fix them on 2.1.0 as soon as possible. Although I'm sorry, it's not now. Maybe, it is one month or more after.
on 2013-02-20 04:54
Issue #5199 has been updated by nobu (Nobuyoshi Nakada). File bug-5199-tkutil.diff added Quick patch. 2.0 has GC safe functions, rb_sprintf() with PRIsVALUE, rb_intern_str(), and so on. ---------------------------------------- Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places https://bugs.ruby-lang.org/issues/5199#change-36641 Author: normalperson (Eric Wong) Status: Assigned Priority: Normal Assignee: nagai (Hidetoshi Nagai) Category: ext Target version: 2.1.0 ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux] I noticed the following in ext/tk/tkutil/tkutil.c: rb_warning("fail to convert '%s' to string for Tk", RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0, 0))); id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str))); I don't use or know the Tk ext at all, but the above examples do not appear safe from a GC perspective. Compilers can optimize the original VALUE away entirely so GC can collect. RSTRING_PTR (being a macro,) may also evaluate its arguments multiple times.
on 2013-02-21 04:32
Issue #5199 has been updated by jonforums (Jon Forums). nobu (Nobuyoshi Nakada) wrote: > Quick patch. > > 2.0 has GC safe functions, rb_sprintf() with PRIsVALUE, rb_intern_str(), and so on. Does a list of these new 2.0 GC-safe functions exist anywhere? If the 2.0 GC-safe functions aren't currently enumerated in a single, accessible place, should they be listed in a new section to README.EXT, and a short note added to mame-san's draft 2.0.0-p0 ANN? Perhaps under "Built-in libraries" as "New GC-safe API for more robust extensions." ---------------------------------------- Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places https://bugs.ruby-lang.org/issues/5199#change-36695 Author: normalperson (Eric Wong) Status: Assigned Priority: Normal Assignee: nagai (Hidetoshi Nagai) Category: ext Target version: 2.1.0 ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux] I noticed the following in ext/tk/tkutil/tkutil.c: rb_warning("fail to convert '%s' to string for Tk", RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0, 0))); id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str))); I don't use or know the Tk ext at all, but the above examples do not appear safe from a GC perspective. Compilers can optimize the original VALUE away entirely so GC can collect. RSTRING_PTR (being a macro,) may also evaluate its arguments multiple times.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.