Ruby 1.9 bug, no copy-on-write for MatchData#post_match

P

Paolo Bonzini

As we found during ruby quiz 155, there is a bug in copy-on-write for
Ruby 1.9.

The following code

size = 100000 * 100
s = "x" * size
a = []
while (m = s.match(/^./))
s = m.post_match
a << s
end

takes 700 megabytes of memory under Ruby 1.8.6; under 1.9.0 instead I
had to remove the "* 100" factor, and even like that it took more than
2 gigabytes.

I guess that an isolated post will be more easily spotted by
interested people than something hidden under ruby quiz. :)

Paolo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top