Skip to content

Commit

Permalink
Only clean up on Capacity change
Browse files Browse the repository at this point in the history
  • Loading branch information
slozier committed Jan 26, 2025
1 parent 7a92772 commit 20c5732
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/IronPython/Runtime/Types/PythonType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2498,7 +2498,9 @@ private void AddSubType(PythonType subtype) {
}

lock (_subtypesLock) {
_subtypes.RemoveAll(x => !x.TryGetTarget(out _)); // remove dead entries
if (_subtypes.Count == _subtypes.Capacity) {
_subtypes.RemoveAll(x => !x.TryGetTarget(out _)); // remove dead entries
}
_subtypes.Add(new WeakReference<PythonType>(subtype));
}
}
Expand Down

0 comments on commit 20c5732

Please sign in to comment.