Skip to content

Commit 42c7c31

Browse files
committed
Only clean up on Capacity change
1 parent c01e8c9 commit 42c7c31

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Src/IronPython/Runtime/Types/PythonType.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2504,7 +2504,9 @@ private void AddSubType(PythonType subtype) {
25042504
}
25052505

25062506
lock (_subtypesLock) {
2507-
_subtypes.RemoveAll(x => !x.TryGetTarget(out _)); // remove dead entries
2507+
if (_subtypes.Count == _subtypes.Capacity) {
2508+
_subtypes.RemoveAll(x => !x.TryGetTarget(out _)); // remove dead entries
2509+
}
25082510
_subtypes.Add(new WeakReference<PythonType>(subtype));
25092511
}
25102512
}

0 commit comments

Comments
 (0)