-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dispose some pooled object instances #7330
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,7 @@ public override void Initialize(AnalysisContext context) | |
|
||
if (wellKnownTypeProvider.TryGetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemCollectionsIList, out var iListType)) | ||
{ | ||
var builder = ArrayBuilder<INamedTypeSymbol>.GetInstance(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 The |
||
using var builder = ArrayBuilder<INamedTypeSymbol>.GetInstance(); | ||
builder.AddIfNotNull(wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemCollectionsGenericIList1)); | ||
builder.AddIfNotNull(wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemCollectionsGenericIReadOnlyList1)); | ||
if (builder.Count > 0) | ||
|
@@ -79,7 +79,7 @@ public override void Initialize(AnalysisContext context) | |
|
||
if (wellKnownTypeProvider.TryGetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemCollectionsICollection, out var iCollectionType)) | ||
{ | ||
var builder = ArrayBuilder<INamedTypeSymbol>.GetInstance(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 The |
||
using var builder = ArrayBuilder<INamedTypeSymbol>.GetInstance(); | ||
builder.AddIfNotNull(wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemCollectionsGenericICollection1)); | ||
builder.AddIfNotNull(wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemCollectionsGenericIReadOnlyCollection1)); | ||
if (builder.Count > 0) | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -261,7 +261,7 @@ internal ValueContentAbstractValue MergeBinaryOperation( | |||||
} | ||||||
|
||||||
// Merge Literals | ||||||
var builder = PooledHashSet<object?>.GetInstance(); | ||||||
using var builder = PooledHashSet<object?>.GetInstance(); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will Dispose() on the error path ( |
||||||
foreach (var leftLiteral in LiteralValues) | ||||||
{ | ||||||
foreach (var rightLiteral in otherState.LiteralValues) | ||||||
|
@@ -275,7 +275,7 @@ internal ValueContentAbstractValue MergeBinaryOperation( | |||||
} | ||||||
} | ||||||
|
||||||
ImmutableHashSet<object?> mergedLiteralValues = builder.ToImmutableAndFree(); | ||||||
ImmutableHashSet<object?> mergedLiteralValues = builder.ToImmutable(); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
ValueContainsNonLiteralState mergedNonLiteralState = Merge(NonLiteralState, otherState.NonLiteralState); | ||||||
|
||||||
return Create(mergedLiteralValues, mergedNonLiteralState); | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
interfaceToGenericInterfaceMapBuilder
need to beDispose()
d too?