RFR: 8341566: Adding factory for non-synchronized CharSequence Reader [v2]

Chen Liang liach at openjdk.org
Mon Oct 7 16:08:36 UTC 2024


On Sun, 6 Oct 2024 17:23:51 GMT, Markus KARG <duke at 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


More information about the core-libs-dev mailing list