On Tue, 7 Dec 2021 10:42:50 GMT, Roman Kennke <rken...@openjdk.org> wrote:

>> The caches in ObjectStreamClass basically map WeakReference<Class> to 
>> SoftReference<ObjectStreamClass>, where the ObjectStreamClass also 
>> references the same Class. That means that the cache entry, and thus the 
>> class and its class-loader, will not get reclaimed, unless the GC determines 
>> that memory pressure is very high.
>> 
>> However, this seems bogus, because that unnecessarily keeps ClassLoaders and 
>> all its classes alive much longer than necessary: as soon as a ClassLoader 
>> (and all its classes) become unreachable, there is no point in retaining the 
>> stuff in OSC's caches.
>> 
>> The proposed change is to use WeakReference instead of SoftReference for the 
>> values in caches.
>> 
>> Testing:
>>  - [x] tier1
>>  - [x] tier2
>>  - [x] tier3
>>  - [ ] tier4
>
> Roman Kennke has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Add improved test by @plevart

This is a P4 bug. If the priority is correct, it does not meet the criteria to 
get it into JDK 18 during RDP1, as indicated in [JEP 
3](https://openjdk.java.net/jeps/3).

If this is objectively a P3 bug, and really does need to go into JDK 18, then 
you will need to close this PR and open a new pull request in the jdk18 repo.

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

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

Reply via email to