Skip to content

Commit 4c58e1b

Browse files
Neethu PrasadPaul Hohensee
authored andcommitted
8325754: Dead AbstractQueuedSynchronizer$ConditionNodes survive minor garbage collections
Backport-of: 60cbf2925024b1c2253256688ae41741fff0a860
1 parent cfe714b commit 4c58e1b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,13 +1080,18 @@ public ConditionObject() { }
10801080
private void doSignal(ConditionNode first, boolean all) {
10811081
while (first != null) {
10821082
ConditionNode next = first.nextWaiter;
1083+
10831084
if ((firstWaiter = next) == null)
10841085
lastWaiter = null;
1086+
else
1087+
first.nextWaiter = null; // GC assistance
1088+
10851089
if ((first.getAndUnsetStatus(COND) & COND) != 0) {
10861090
enqueue(first);
10871091
if (!all)
10881092
break;
10891093
}
1094+
10901095
first = next;
10911096
}
10921097
}

src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,13 +1448,18 @@ public ConditionObject() { }
14481448
private void doSignal(ConditionNode first, boolean all) {
14491449
while (first != null) {
14501450
ConditionNode next = first.nextWaiter;
1451+
14511452
if ((firstWaiter = next) == null)
14521453
lastWaiter = null;
1454+
else
1455+
first.nextWaiter = null; // GC assistance
1456+
14531457
if ((first.getAndUnsetStatus(COND) & COND) != 0) {
14541458
enqueue(first);
14551459
if (!all)
14561460
break;
14571461
}
1462+
14581463
first = next;
14591464
}
14601465
}

0 commit comments

Comments
 (0)