On Mon, 11 Apr 2022 22:31:01 GMT, Brian Burkhalter <b...@openjdk.org> wrote:

> Even so, it does appear that prior buffer allocations could be "lost" due to 
> concurrent use of skip resulting in a "minor" memory leak in the heap.

The minor leak, though maybe somewhat wasteful, is the necessary cost for 
thread safety as opposed to locking or synchronizing to reliably retrieve a 
previously allocated array from another thread.

Another concern about this change is that now the skip buffer is no longer 
immediately GC'd when exiting the scope but will live on till the input stream 
is no longer reachable. For instance, if an input stream is skipped and then 
kept for long, this may be a performance regression instead for the increased 
memory use.

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

PR: https://git.openjdk.java.net/jdk/pull/5872

Reply via email to