RFR: 8296919: Make system tests that detect memory leaks more robust by using JMemoryBuddy utility [v2]

Andy Goryachev angorya at openjdk.org
Tue May 2 15:54:28 UTC 2023


On Tue, 2 May 2023 11:08:18 GMT, Lukasz Kostyra <lkostyra at openjdk.org> wrote:

>> Verified these changes on all platforms and saw no abnormalities in test execution.
>> 
>> This change is based on a preliminary patch done by @aghaisas , with some minor changes and the addition of one Leak-related web test. EventListenerLeak test was not touched, as it is a separate manual test app instead of a JUnit test.
>
> Lukasz Kostyra has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address review issues
>   
>   * JMemoryBuddy now has helpers for arrays of WeakReference, ArrayList
>     of WeakReference and vararg WeakReferences
>   * Updated copyright years in some files which were missed in previous
>     changes

modules/javafx.base/src/test/java/test/util/memory/JMemoryBuddy.java line 101:

> 99:     }
> 100: 
> 101:     public static <T> void assertCollectable(ArrayList<WeakReference<T>> weakReferences) {

Could we change the argument to Collection<...>?

modules/javafx.web/src/test/java/test/javafx/scene/web/LeakTest.java line 95:

> 93: 
> 94:         for (WeakReference ref : willGC) {
> 95:             JMemoryBuddy.assertCollectable(ref);

should we use newly added methods here?

modules/javafx.web/src/test/java/test/javafx/scene/web/LeakTest.java line 122:

> 120: 
> 121:         for (WeakReference ref : willGC) {
> 122:             JMemoryBuddy.assertCollectable(ref);

ditto, new methods?

modules/javafx.web/src/test/java/test/javafx/scene/web/LeakTest.java line 224:

> 222:         Thread.sleep(SLEEP_TIME);
> 223:         for (WeakReference ref : willGC) {
> 224:             JMemoryBuddy.assertCollectable(ref);

and here

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1121#discussion_r1182737400
PR Review Comment: https://git.openjdk.org/jfx/pull/1121#discussion_r1182738142
PR Review Comment: https://git.openjdk.org/jfx/pull/1121#discussion_r1182738501
PR Review Comment: https://git.openjdk.org/jfx/pull/1121#discussion_r1182738706


More information about the openjfx-dev mailing list