On Sun, 6 Oct 2024 17:23:51 GMT, Markus KARG <d...@openjdk.org> wrote:

> keep the reference to the char sequence "forever"

Note that this only happens if the `Reader` instance is kept forever; but a 
`Reader` is supposed to be used and closed and discarded instead of being held 
indefinitely after closing. If users are bad enough, they can never call 
`close` and the non-final `cs` is still leaked.

The right way of GC freeing is to let the GC free the reader and the char 
sequence together, instead of allowing to free when a client keeps this reader 
instance erroneously after closing.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1790505636

Reply via email to