Skip to content

Commit 241b054

Browse files
neethu-prasadRealCLanger
authored andcommitted
8325754: Dead AbstractQueuedSynchronizer$ConditionNodes survive minor garbage collections
Backport-of: 60cbf2925024b1c2253256688ae41741fff0a860
1 parent 57824ed commit 241b054

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
@@ -1127,13 +1127,18 @@ public ConditionObject() { }
11271127
private void doSignal(ConditionNode first, boolean all) {
11281128
while (first != null) {
11291129
ConditionNode next = first.nextWaiter;
1130+
11301131
if ((firstWaiter = next) == null)
11311132
lastWaiter = null;
1133+
else
1134+
first.nextWaiter = null; // GC assistance
1135+
11321136
if ((first.getAndUnsetStatus(COND) & COND) != 0) {
11331137
enqueue(first);
11341138
if (!all)
11351139
break;
11361140
}
1141+
11371142
first = next;
11381143
}
11391144
}

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
@@ -1506,13 +1506,18 @@ public ConditionObject() { }
15061506
private void doSignal(ConditionNode first, boolean all) {
15071507
while (first != null) {
15081508
ConditionNode next = first.nextWaiter;
1509+
15091510
if ((firstWaiter = next) == null)
15101511
lastWaiter = null;
1512+
else
1513+
first.nextWaiter = null; // GC assistance
1514+
15111515
if ((first.getAndUnsetStatus(COND) & COND) != 0) {
15121516
enqueue(first);
15131517
if (!all)
15141518
break;
15151519
}
1520+
15161521
first = next;
15171522
}
15181523
}

0 commit comments

Comments
 (0)