Commit 86e17df
committed
Do not poll 100 times when asserting a reference is not enqueued
LeakTests.checkRef() polls up to 100 times, calling System.gc() and
blocking for up to 100ms on ReferenceQueue.remove() in each round. It
breaks out as soon as the reference is enqueued, so the positive case
is cheap.
DynamicSupportTests.testConfigurationElementTracker4 asserted the
opposite, that the object stays reachable because the tracker holds a
strong reference, by wrapping checkRef() in assertThrows(). That case
exhausts all 100 rounds by design, costing 10s of poll timeouts plus
100 full garbage collections on every run. Measured on a full CI run it
is 20.33s of the class total of 20.4s, while its three sibling tests
take 0.10s together.
Add checkRefNotEnqueued() with a small poll count for this case. It is
the only negative call site among the 23 checkRef() uses in the
repository.1 parent 51efa85 commit 86e17df
2 files changed
Lines changed: 19 additions & 8 deletions
File tree
- tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests
- dynamicplugins
- leaks
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
93 | 92 | | |
94 | 93 | | |
95 | 94 | | |
96 | | - | |
| 95 | + | |
97 | 96 | | |
98 | 97 | | |
99 | 98 | | |
| |||
Lines changed: 18 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | | - | |
73 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
74 | 88 | | |
75 | 89 | | |
76 | 90 | | |
77 | 91 | | |
78 | 92 | | |
79 | | - | |
80 | | - | |
| 93 | + | |
81 | 94 | | |
82 | 95 | | |
83 | | - | |
84 | | - | |
| 96 | + | |
85 | 97 | | |
86 | 98 | | |
87 | 99 | | |
| |||
0 commit comments