News for hackers. Stuff that matters.
Re:JDK-4513622: keeping a substring of a field prevents GC f... by pimlottc on Sunday March 08, 2015 @02:08PM (#9166465)
This needs a 2001 tag, particular since it is no longer the case as others have pointed out.
Re:JDK-4513622: keeping a substring of a field prevents GC f... by masklinn on Sunday March 08, 2015 @03:05PM (#9166721)
It is probably the case in other languages though (I believe — though I'm open to being wrong — it is in Go, string slicing is implemented through array slicing, so a substring will share the parent string's storage and keep it alive).
[deleted]
Re:JDK-4513622: keeping a substring of a field prevents GC f... by masklinn on Sunday March 08, 2015 @03:44PM (#9166910)
> substrings are mutable

Are you sure? I know that a byte slice []byte is mutable, but I thought slicing a string yielded a string (and strings are immutable), an explicit conversion (and copy) is needed to get the underlying byte slice.

Re:JDK-4513622: keeping a substring of a field prevents GC f... by pcwalton on Sunday March 08, 2015 @04:13PM (#9167031)
Oh yes, my mistake, they're immutable. I was thinking of []byte.