RFR: 8244297: Provide utility for testing for memory leaks [v6]
Florian Kirmaier
fkirmaier at openjdk.java.net
Thu Oct 22 19:29:30 UTC 2020
On Wed, 7 Oct 2020 12:09:15 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:
>> Florian Kirmaier has updated the pull request incrementally with one additional commit since the last revision:
>>
>> JDK-8244297
>> Fixed unit-test
>
> modules/javafx.base/src/test/java/test/util/memory/JMemoryBuddy.java line 132:
>
>> 130: * Checks whether the content of the WeakReference can not be collected.
>> 131: * @param weakReference The WeakReference to check.
>> 132: * @return Returns true, when the provided WeakReference can be collected.
>
> needs typo correction: can not be collected
done
> modules/javafx.base/src/test/java/test/util/memory/JMemoryBuddy.java line 152:
>
>> 150: f.accept(new MemoryTestAPI() {
>> 151: public void assertCollectable(Object ref) {
>> 152: if(ref == null) throw new NullPointerException();
>
> `Object.requireNonNull()` method would be more suitable choice for null check.
done
> modules/javafx.base/src/test/java/test/util/memory/JMemoryBuddy.java line 113:
>
>> 111: if(weakReference.get() == null && counter < steps / 3) {
>> 112: int percentageUsed = (int) ((steps - counter) / steps * 100);
>> 113: System.out.println("Warning test seems to be unstable. time used: " + percentageUsed + "%");
>
> Seems like candidate for `System.err.`
That might be true, but honestly, I'm using System.err so rarely (never) that I have a better feeling avoiding it altogether and eliminating the chance for rare cornercases.
-------------
PR: https://git.openjdk.java.net/jfx/pull/204
More information about the openjfx-dev
mailing list