RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v6]
Roman Kennke
rkennke at openjdk.java.net
Mon Dec 6 12:12:48 UTC 2021
On Sat, 4 Dec 2021 08:47:03 GMT, Peter Levart <plevart at openjdk.org> wrote:
>> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Remove unnecessary import
>
> src/java.base/share/classes/java/io/ClassCache.java line 63:
>
>> 61: protected SoftReference<T> computeValue(Class<?> type) {
>> 62: return new SoftReference<>(ClassCache.this.computeValue(type), queue);
>> 63: }
>
> How does this work? You create a bare SoftReference here and register it with queue....
>
> ...then down in processQueue() you pick it up and cast to CacheRef... Doesn't this throw ClassCastException ?
>
Indeed, good catch! Apparently no test (existing or new) covers the memory-pressure scenario. My new test only covers the scenario when the Class disappears altogether. I added a test to verify behaviour under memory pressure, and pushed a fix.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6375
More information about the core-libs-dev
mailing list