Issue #8149 has been reported by tmm1 (Aman Gupta). ---------------------------------------- Bug #8149: [patch] iseq: remove duplicate strings for file paths https://bugs.ruby-lang.org/issues/8149 Author: tmm1 (Aman Gupta) Status: Open Priority: Normal Assignee: ko1 (Koichi Sasada) Category: Target version: ruby -v: ruby 2.1.0dev (2013-03-22 trunk 39875) [x86_64-darwin12.2.1] with: ./ruby -Ilib -e' GC.start; p ObjectSpace.each_object(String).to_a.select{ |s| s =~ /rubygems\/defaults/ }.inject(Hash.new 0){|h,s| h[s]+=1; h} ' before: {"/Users/test/code/ruby-trunk/lib/rubygems/defaults.rb"=>3} after: {"/Users/test/code/ruby-trunk/lib/rubygems/defaults.rb"=>1} diff --git a/iseq.c b/iseq.c index 288d3bf..72c92bd 100644 --- a/iseq.c +++ b/iseq.c @@ -188,7 +188,10 @@ iseq_location_setup(rb_iseq_t *iseq, VALUE path, VALUE absolute_path, VALUE name { rb_iseq_location_t *loc = &iseq->location; loc->path = path; - loc->absolute_path = absolute_path; + if (RTEST(absolute_path) && rb_str_cmp(path, absolute_path) == 0) + loc->absolute_path = path; + else + loc->absolute_path = absolute_path; loc->label = loc->base_label = name; loc->first_lineno = first_lineno; return loc; -- http://bugs.ruby-lang.org/