RFR: 8260621: (jrtfs) ThreadLocal memory leak in ImageBufferCache when using jrtfs

Alan Bateman alanb at openjdk.java.net
Wed May 5 10:19:50 UTC 2021


On Tue, 4 May 2021 09:05:38 GMT, Athijegannathan Sundararajan <sundar at openjdk.org> wrote:

> Instead of BufferReference class, Map.Entry is used as pair implementation.
> This avoids the metaspace leak seen via thread local.

src/java.base/share/classes/jdk/internal/jimage/ImageBufferCache.java line 46:

> 44: 
> 45:     /*
> 46:      * We used to have a class BufferReference extending from WeakReference<ByteBuffer>.

I think this comment needs to be re-worded to drop "We used to have ...", "Solution is ..." and the other history. Instead it should provide a clear paragraph that explains the value of the TL for anyone reading this code.

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

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


More information about the core-libs-dev mailing list