RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v2]
Roman Kennke
rkennke at openjdk.java.net
Mon Nov 15 21:35:12 UTC 2021
On Mon, 15 Nov 2021 19:30:54 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Roman Kennke has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - Use ForceGC instead of System.gc()
>> - Convert test to testng
>
> test/jdk/java/io/ObjectStreamClass/TestOSCClassLoaderLeak.java line 55:
>
>> 53: con = null;
>> 54: assert myOwnClassLoaderWeakReference.get() != null;
>> 55:
>
> It is preferable is to write (new) tests using TestNG.
> Relying on Assert to be enabled is not reliable.
> It is preferable to make the checks explicit and throw RuntimeExceptions on failure.
Ok, I've changed to TestNG. Even though I often find that it's easier to debug a problem with a simple main method, instead of figuring out how to run the test in TestNG.
> test/jdk/java/io/ObjectStreamClass/TestOSCClassLoaderLeak.java line 57:
>
>> 55:
>> 56: gc();
>> 57:
>
> Is the dependency on ParallelGC necessary?
> To may understanding invoking System.gc() is only a request to gc and does not reflect any idea that it has completed.
> There is a function in the test library util/ForceGC to ensure gc has completed.
ParallelGC is not necessary, this was a left-over from my own testing. I've removed it. I've also changed to use ForceGC, I did not know that it exists :-)
-------------
PR: https://git.openjdk.java.net/jdk/pull/6375
More information about the core-libs-dev
mailing list