Hi:
I have some code sitting around that used the notation
(Yes, it was written long ago before I knew better)
s = ""
s += "whatever"
I tried to use it today with 1.8.0, but my program
went wild on memory usage.
(Now, remember, this code worked fine under 1.6.7 and
possibly 1.7.3.)
Simply changing it to
s = ""
s << "whatever"
fixes the problem. So, I did a little test:
s = ""
100000.times { |i|
s << "fred\n" # this completes in less than 1 second
#s += "fred\n" # this blows up real fast
}
Is there a problem with String#+= or is it something
that we should avoid?
--
Jim Freeze
----------