From: "tmm1 (Aman Gupta)" Date: 2013-11-26T18:56:47+09:00 Subject: [ruby-core:58601] [ruby-trunk - Bug #9159] [patch] use rb_fstring for internal strings Issue #9159 has been updated by tmm1 (Aman Gupta). > if (nd_type(node) == NODE_STR) { > - hide_obj(node->nd_lit); > + node->nd_lit = rb_fstring(node->nd_lit); > ADD_INSN1(ret, nd_line(node), putobject, node->nd_lit); Some internal strings are no longer hidden with this patch, since the underlying T_STRING object can be shared via the fstr table. Since the object is already marked immutable (via the frozen flag), hiding it is unnecessary. ---------------------------------------- Bug #9159: [patch] use rb_fstring for internal strings https://bugs.ruby-lang.org/issues/9159#change-43169 Author: tmm1 (Aman Gupta) Status: Open Priority: Normal Assignee: Category: Target version: current: 2.1.0 ruby -v: ruby 2.1.0dev (2013-11-26 trunk 43852) Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN I added rb_fstring wrappers around internal strings generated by iseqs, regexps and eval: https://github.com/tmm1/ruby/commit/9587fae171835ccf013661ba837f097754f170ef In our rails app, this reduces the number of long-lived strings on the heap by 30%. $ ruby -rconfig/environment -e' GC.start; p ObjectSpace.count_objects[:T_STRING] ' 246100 $ ruby -rconfig/environment -e' GC.start; p ObjectSpace.count_objects[:T_STRING] ' 173956 If this patch is acceptable, I can commit it. make test and test-all pass. -- http://bugs.ruby-lang.org/