From: Quet Zal Date: 2009-06-08T22:04:32+09:00 Subject: [ruby-core:23755] Re: [Bug #1587] Problem with string sharing --0016e6de1524e527bc046bd5e12d Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Here's even more simplified example how to reproduce this bug. (First one didnt work on linux). === s1 = String.new() 10.times { s1 << "abc" } p s1 s2 = s1.dup p s2 s1.replace("xxx"); p s1 p s2 === Run with valgrind --free-fill=AA ./miniruby test.rb --0016e6de1524e527bc046bd5e12d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
Here's even more simplified example how to reproduce this bug. (First one didnt work on linux).
===
s1 = String.new()
10.times { s1 << "abc" }
p s1
s2 = s1.dup
p s2
s1.replace("xxx");
p s1
p s2
===
Run with valgrind --free-fill=AA ./miniruby test.rb
--0016e6de1524e527bc046bd5e12d--