Java moves to copying for substrings

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Mon Nov 18 21:38:12 PST 2013


Somewhat interesting, Java has chosen to make substring result in 
a copy of the string data rather than returning a window of the 
underlying chars.

http://www.reddit.com/r/programming/comments/1qw73v/til_oracle_changed_the_internal_string/

"reduce the size of String instances. [...] This was the trigger."

"avoid memory leakage caused by retained substrings holding the 
entire character array."

So apparently substrings were considered a common cause of memory 
leaks. I got the impression most of the comments agreed the 
result is good, but changing the complexity is bad.

I'm not advocating such a change for D.


More information about the Digitalmars-d mailing list