RFR: 8260621: Avoid memory leak in ImageBufferCache [v2]
Bo Zhang
github.com+12689835+blindpirate at openjdk.java.net
Wed Feb 3 01:29:02 UTC 2021
> Previously, `ImageBufferCache` contains a ThreadLocal field which holds
> strong reference to `ImageBufferCache$BufferReference.class`. When loaded
> from `jrt-fs.jar`, this will keep `JrtFileSystemProvider$JrtFsLoader`
> in memory forever and never being GCed.
>
> The fix replace the old `ImageBufferCache$BufferReference` class with
> `WeakReference<ByteBuffer>`, which is verified by provided test.
Bo Zhang has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
8260621: Avoid memory leak in ImageBufferCache
Previously, `ImageBufferCache` contains a ThreadLocal field which holds
strong reference to `ImageBufferCache$BufferReference.class`. When loaded
from `jrt-fs.jar`, this will keep `JrtFileSystemProvider$JrtFsLoader`
in memory forever and never being GCed.
The fix replace the old `ImageBufferCache$BufferReference` class with
`WeakReference<ByteBuffer>`, which is verified by provided test.
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/2307/files
- new: https://git.openjdk.java.net/jdk/pull/2307/files/8d61d77d..27b55790
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2307&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2307&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/2307.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2307/head:pull/2307
PR: https://git.openjdk.java.net/jdk/pull/2307
More information about the core-libs-dev
mailing list