#2413 String.replace()

SlimerDude Thu 30 Apr 2015

This:

"Whoops!".replace("", "XXX")

Produces:

sys::Err: java.lang.OutOfMemoryError: Java heap space

My fault I know, but it'd be nice if Fantom guarded against it.

(I still think it should be renamed to replaceAll()!)

brian Thu 30 Apr 2015

Thanks for reporting, that is a bad one! I pushed a fix

SlimerDude Tue 16 Feb 2016

One of my programs has been hanging indefinitely, and I've just spent more time than I care to admit tracking down the cause. I was formatting / cleaning up a debug message like this:

var := "" // maybe anything, but sometimes is an empty Str
msg := "some string".replace(var, "")

Replacing an empty string with an empty string causes the hang (an infinite loop I guess) as oppose to an OutOfMemoryError.

Given this was fixed 10 months ago and is no longer an issue in the next version of Fantom, I too am keen to know when Fantom 1.0.68 will be released.

Login or Signup to reply.