66 instantiations of ObjectPool
IdeCoreBenchmarks (1)
CloudCachePersistentStorage.cs (1)
27private static readonly ObjectPool<byte[]> s_byteArrayPool = new(() => new byte[Checksum.HashSize]);
Microsoft.CodeAnalysis.CSharp.Workspaces (11)
Simplification\Reducers\CSharpCastReducer.cs (1)
19private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpDefaultExpressionReducer.cs (1)
13private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpEscapingReducer.cs (1)
21private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpExtensionMethodReducer.cs (1)
21private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpInferredMemberNameReducer.cs (1)
18private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpMiscellaneousReducer.cs (1)
24private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpNameReducer.cs (1)
21private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpNullableAnnotationReducer.cs (1)
19private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpParenthesizedExpressionReducer.cs (1)
19private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpParenthesizedPatternReducer.cs (1)
21private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpVarReducer.cs (1)
13private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Microsoft.CodeAnalysis.EditorFeatures (2)
IntelliSense\AsyncCompletion\ItemManager.CompletionListUpdater.cs (1)
68private static readonly ObjectPool<List<MatchResult>> s_listOfMatchResultPool = new(factory: () => new());
KeywordHighlighting\HighlighterViewTaggerProvider.cs (1)
40private static readonly PooledObjects.ObjectPool<List<TextSpan>> s_listPool = new(() => new List<TextSpan>());
Microsoft.CodeAnalysis.ExternalAccess.FSharp (1)
Internal\Classification\FSharpClassificationService.cs (1)
24private readonly ObjectPool<List<ClassifiedSpan>> s_listPool = new(() => new());
Microsoft.CodeAnalysis.Features (12)
AbstractUseAutoPropertyAnalyzer.cs (5)
36private static readonly ObjectPool<ConcurrentStack<AnalysisResult>> s_analysisResultPool = new(() => new()); 37private static readonly ObjectPool<ConcurrentSet<IFieldSymbol>> s_fieldSetPool = new(() => new()); 38private static readonly ObjectPool<ConcurrentSet<SyntaxNode>> s_nodeSetPool = new(() => new()); 39private static readonly ObjectPool<ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>>> s_fieldWriteLocationPool = new(() => new()); 55_fieldNamesPool = new(() => new(this.SyntaxFacts.StringComparer));
Completion\CompletionService.cs (1)
239private static readonly ObjectPool<List<MatchResult>> s_listOfMatchResultPool = new(factory: () => new());
Completion\CompletionService_GetCompletions.cs (2)
346private static readonly ObjectPool<Dictionary<string, object>> s_uniqueSourcesPool = new(factory: () => new Dictionary<string, object>(), size: 5); 347private static readonly ObjectPool<List<CompletionItem>> s_sortListPool = new(factory: () => new List<CompletionItem>(), size: 5);
EmbeddedLanguages\Json\LanguageServices\JsonClassifier.cs (1)
30private static readonly ObjectPool<Visitor> s_visitorPool = new(() => new Visitor());
Highlighting\HighlightingService.cs (1)
22private static readonly PooledObjects.ObjectPool<List<TextSpan>> s_listPool = new(() => new List<TextSpan>());
Highlighting\Keywords\AbstractKeywordHighlighter.cs (2)
26private static readonly ObjectPool<List<TextSpan>> s_textSpanListPool = new(() => new List<TextSpan>()); 27private static readonly ObjectPool<List<SyntaxToken>> s_tokenListPool = new(() => new List<SyntaxToken>());
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
CloudCachePersistentStorage.cs (1)
27private static readonly ObjectPool<byte[]> s_byteArrayPool = new(() => new byte[Checksum.HashSize]);
Microsoft.CodeAnalysis.VisualBasic.Workspaces (9)
Simplification\Reducers\VisualBasicCallReducer.vb (1)
16New ObjectPool(Of IReductionRewriter)(Function() New Rewriter(s_pool))
Simplification\Reducers\VisualBasicCastReducer.vb (1)
16New ObjectPool(Of IReductionRewriter)(Function() New Rewriter(s_pool))
Simplification\Reducers\VisualBasicEscapingReducer.vb (1)
16New ObjectPool(Of IReductionRewriter)(Function() New Rewriter(s_pool))
Simplification\Reducers\VisualBasicExtensionMethodReducer.vb (1)
15New ObjectPool(Of IReductionRewriter)(Function() New Rewriter(s_pool))
Simplification\Reducers\VisualBasicInferredMemberNameReducer.vb (1)
17New ObjectPool(Of IReductionRewriter)(Function() New Rewriter(s_pool))
Simplification\Reducers\VisualBasicMiscellaneousReducer.vb (1)
16New ObjectPool(Of IReductionRewriter)(Function() New Rewriter(s_pool))
Simplification\Reducers\VisualBasicNameReducer.vb (1)
20New ObjectPool(Of IReductionRewriter)(Function() New Rewriter(s_pool))
Simplification\Reducers\VisualBasicParenthesesReducer.vb (1)
11New ObjectPool(Of IReductionRewriter)(Function() New Rewriter(s_pool))
Simplification\Reducers\VisualBasicVariableDeclaratorReducer.vb (1)
19New ObjectPool(Of IReductionRewriter)(Function() New Rewriter(s_pool))
Microsoft.CodeAnalysis.Workspaces (27)
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (1)
39private static readonly ObjectPool<Stack<SyntaxNodeOrToken>> s_pool = new(() => new());
Differencing\LongestCommonSubsequence.cs (1)
18private static readonly ObjectPool<VBuffer> s_pool = new(() => new VBuffer());
ExternalAccess\Pythia\Api\PythiaObjectPool.cs (1)
42public static readonly ObjectPool<T> Instance = new(() => new T(), 20);
FindSymbols\FindReferences\FindReferencesSearchEngine.cs (1)
23private static readonly ObjectPool<MetadataUnifyingSymbolHashSet> s_metadataUnifyingSymbolHashSetPool = new(() => new());
J\s\src\Dependencies\PooledObjects\ArrayBuilder.cs\ArrayBuilder.cs (1)
426pool = new ObjectPool<ArrayBuilder<T>>(() => new ArrayBuilder<T>(pool!), size);
J\s\src\Dependencies\PooledObjects\PooledDictionary.cs\PooledDictionary.cs (1)
46pool = new ObjectPool<PooledDictionary<K, V>>(() => new PooledDictionary<K, V>(pool!, keyComparer), 128);
J\s\src\Dependencies\PooledObjects\PooledHashSet.cs\PooledHashSet.cs (1)
35pool = new ObjectPool<PooledHashSet<T>>(() => new PooledHashSet<T>(pool!, equalityComparer), 128);
J\s\src\Dependencies\PooledObjects\PooledStringBuilder.cs\PooledStringBuilder.cs (1)
84pool = new ObjectPool<PooledStringBuilder>(() => new PooledStringBuilder(pool!), size);
Log\KeyValueLogMessage.cs (1)
20private static readonly ObjectPool<KeyValueLogMessage> s_pool = new(() => new KeyValueLogMessage(), 20);
Logger.LogBlock.cs (1)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256));
ObjectReader.cs (1)
322= new(() => new SegmentedList<T>(20));
ObjectWriter.cs (2)
393new(() => new SegmentedDictionary<object, int>(128, ReferenceEqualityComparer.Instance)); 396new(() => new SegmentedDictionary<object, int>(128));
OrderPreservingMultiDictionary.cs (1)
59var pool = new ObjectPool<OrderPreservingMultiDictionary<K, V>>(
PooledDelegates.cs (1)
18public static readonly ObjectPool<T> Instance = new(() => new T(), 20);
Serialization\SolutionReplicationContext.cs (1)
13private static readonly ObjectPool<ConcurrentSet<IDisposable>> s_pool = new(() => new());
SharedPools.cs (7)
44new(() => new HashSet<string>(StringComparer.OrdinalIgnoreCase), 20); 50new(() => new HashSet<string>(StringComparer.Ordinal), 20); 56public static readonly ObjectPool<byte[]> ByteArray = new(() => new byte[ByteBufferSize], ByteBufferCount); 57public static readonly ObjectPool<char[]> CharArray = new(() => new char[ByteBufferSize], CharBufferCount); 68public static readonly ObjectPool<T> Instance = new(() => new T(), 100); 73public static readonly ObjectPool<T> Instance = new(() => new T(), 20); 79new(() => new Dictionary<string, T>(StringComparer.OrdinalIgnoreCase), 20);
StringTable.cs (1)
94var pool = new ObjectPool<StringTable>(pool => new StringTable(pool), Environment.ProcessorCount * 2);
SymbolUsageAnalysis.BasicBlockAnalysisData.cs (1)
24new(() => new BasicBlockAnalysisData());
SymbolUsageAnalysis.Walker.cs (1)
32private static readonly ObjectPool<Walker> s_visitorPool = new(() => new Walker());
Workspace\Solution\Checksum_Factory.cs (1)
23new(() => IncrementalHash.CreateHash(HashAlgorithmName.SHA256), size: 20);
Microsoft.VisualStudio.LanguageServices (2)
InheritanceMargin\InheritanceMarginHelpers.cs (1)
21private static readonly ObjectPool<MultiDictionary<string, InheritanceTargetItem>> s_pool = new(() => new());
Storage\CloudCachePersistentStorage.cs (1)
27private static readonly ObjectPool<byte[]> s_byteArrayPool = new(() => new byte[Checksum.HashSize]);
201 references to ObjectPool
IdeCoreBenchmarks (1)
CloudCachePersistentStorage.cs (1)
27private static readonly ObjectPool<byte[]> s_byteArrayPool = new(() => new byte[Checksum.HashSize]);
Microsoft.CodeAnalysis.CSharp.Features (1)
Highlighting\KeywordHighlighters\AsyncAwaitHighlighter.cs (1)
24private static readonly ObjectPool<Stack<SyntaxNode>> s_stackPool
Microsoft.CodeAnalysis.CSharp.Workspaces (26)
ParenthesizedExpressionSyntaxExtensions.cs (1)
320private static readonly ObjectPool<Stack<SyntaxNode>> s_nodeStackPool = SharedPools.Default<Stack<SyntaxNode>>();
Simplification\Reducers\AbstractCSharpReducer.AbstractReductionRewriter.cs (2)
22private readonly ObjectPool<IReductionRewriter> _pool; 37protected AbstractReductionRewriter(ObjectPool<IReductionRewriter> pool)
Simplification\Reducers\AbstractCSharpReducer.cs (1)
14protected AbstractCSharpReducer(ObjectPool<IReductionRewriter> pool) : base(pool)
Simplification\Reducers\CSharpCastReducer.cs (1)
19private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpCastReducer.Rewriter.cs (1)
18public Rewriter(ObjectPool<IReductionRewriter> pool)
Simplification\Reducers\CSharpDefaultExpressionReducer.cs (1)
13private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpDefaultExpressionReducer.Rewriter.cs (1)
22public Rewriter(ObjectPool<IReductionRewriter> pool)
Simplification\Reducers\CSharpEscapingReducer.cs (1)
21private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpEscapingReducer.Rewriter.cs (1)
15public Rewriter(ObjectPool<IReductionRewriter> pool)
Simplification\Reducers\CSharpExtensionMethodReducer.cs (1)
21private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpExtensionMethodReducer.Rewriter.cs (1)
16public Rewriter(ObjectPool<IReductionRewriter> pool)
Simplification\Reducers\CSharpInferredMemberNameReducer.cs (1)
18private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpInferredMemberNameReducer.Rewriter.cs (1)
22public Rewriter(ObjectPool<IReductionRewriter> pool)
Simplification\Reducers\CSharpMiscellaneousReducer.cs (1)
24private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpMiscellaneousReducer.Rewriter.cs (1)
16public Rewriter(ObjectPool<IReductionRewriter> pool)
Simplification\Reducers\CSharpNameReducer.cs (1)
21private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpNameReducer.Rewriter.cs (1)
19public Rewriter(ObjectPool<IReductionRewriter> pool)
Simplification\Reducers\CSharpNullableAnnotationReducer.cs (1)
19private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpNullableAnnotationReducer.Rewriter.cs (1)
16public Rewriter(ObjectPool<IReductionRewriter> pool) : base(pool)
Simplification\Reducers\CSharpParenthesizedExpressionReducer.cs (1)
19private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpParenthesizedExpressionReducer.Rewriter.cs (1)
16public Rewriter(ObjectPool<IReductionRewriter> pool)
Simplification\Reducers\CSharpParenthesizedPatternReducer.cs (1)
21private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpParenthesizedPatternReducer.Rewriter.cs (1)
16public Rewriter(ObjectPool<IReductionRewriter> pool)
Simplification\Reducers\CSharpVarReducer.cs (1)
13private static readonly ObjectPool<IReductionRewriter> s_pool = new(
Simplification\Reducers\CSharpVarReducer.Rewriter.cs (1)
18public Rewriter(ObjectPool<IReductionRewriter> pool)
Microsoft.CodeAnalysis.EditorFeatures (2)
IntelliSense\AsyncCompletion\ItemManager.CompletionListUpdater.cs (1)
68private static readonly ObjectPool<List<MatchResult>> s_listOfMatchResultPool = new(factory: () => new());
KeywordHighlighting\HighlighterViewTaggerProvider.cs (1)
40private static readonly PooledObjects.ObjectPool<List<TextSpan>> s_listPool = new(() => new List<TextSpan>());
Microsoft.CodeAnalysis.ExternalAccess.FSharp (1)
Internal\Classification\FSharpClassificationService.cs (1)
24private readonly ObjectPool<List<ClassifiedSpan>> s_listPool = new(() => new());
Microsoft.CodeAnalysis.Features (16)
AbstractUseAutoPropertyAnalyzer.cs (5)
36private static readonly ObjectPool<ConcurrentStack<AnalysisResult>> s_analysisResultPool = new(() => new()); 37private static readonly ObjectPool<ConcurrentSet<IFieldSymbol>> s_fieldSetPool = new(() => new()); 38private static readonly ObjectPool<ConcurrentSet<SyntaxNode>> s_nodeSetPool = new(() => new()); 39private static readonly ObjectPool<ConcurrentDictionary<IFieldSymbol, ConcurrentSet<SyntaxNode>>> s_fieldWriteLocationPool = new(() => new()); 46private readonly ObjectPool<HashSet<string>> _fieldNamesPool;
Completion\CompletionService.cs (1)
239private static readonly ObjectPool<List<MatchResult>> s_listOfMatchResultPool = new(factory: () => new());
Completion\CompletionService_GetCompletions.cs (2)
346private static readonly ObjectPool<Dictionary<string, object>> s_uniqueSourcesPool = new(factory: () => new Dictionary<string, object>(), size: 5); 347private static readonly ObjectPool<List<CompletionItem>> s_sortListPool = new(factory: () => new List<CompletionItem>(), size: 5);
EmbeddedLanguages\Json\LanguageServices\JsonClassifier.cs (1)
30private static readonly ObjectPool<Visitor> s_visitorPool = new(() => new Visitor());
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexClassifier.cs (1)
32private static readonly ObjectPool<Visitor> s_visitorPool = SharedPools.Default<Visitor>();
Highlighting\HighlightingService.cs (1)
22private static readonly PooledObjects.ObjectPool<List<TextSpan>> s_listPool = new(() => new List<TextSpan>());
Highlighting\Keywords\AbstractKeywordHighlighter.cs (2)
26private static readonly ObjectPool<List<TextSpan>> s_textSpanListPool = new(() => new List<TextSpan>()); 27private static readonly ObjectPool<List<SyntaxToken>> s_tokenListPool = new(() => new List<SyntaxToken>());
MetadataAsSource\DocumentationCommentUtilities.cs (1)
16private static readonly ObjectPool<List<string>> s_pool = SharedPools.Default<List<string>>();
UseCollectionInitializerAnalyzer.cs (1)
36private static readonly ObjectPool<UseCollectionInitializerAnalyzer<TExpressionSyntax, TStatementSyntax, TObjectCreationExpressionSyntax, TMemberAccessExpressionSyntax, TInvocationExpressionSyntax, TExpressionStatementSyntax, TVariableDeclaratorSyntax>> s_pool
UseNamedMemberInitializerAnalyzer.cs (1)
32private static readonly ObjectPool<UseNamedMemberInitializerAnalyzer<TExpressionSyntax, TStatementSyntax, TObjectCreationExpressionSyntax, TMemberAccessExpressionSyntax, TAssignmentStatementSyntax, TVariableDeclaratorSyntax>> s_pool
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
CloudCachePersistentStorage.cs (1)
27private static readonly ObjectPool<byte[]> s_byteArrayPool = new(() => new byte[Checksum.HashSize]);
Microsoft.CodeAnalysis.VisualBasic.Workspaces (21)
Simplification\Reducers\AbstractVisualBasicReducer.AbstractReductionRewriter.vb (2)
17Private ReadOnly _pool As ObjectPool(Of IReductionRewriter) 29Protected Sub New(pool As ObjectPool(Of IReductionRewriter))
Simplification\Reducers\AbstractVisualBasicReducer.vb (1)
17Protected Sub New(pool As ObjectPool(Of IReductionRewriter))
Simplification\Reducers\VisualBasicCallReducer.Rewriter.vb (1)
13Public Sub New(pool As ObjectPool(Of IReductionRewriter))
Simplification\Reducers\VisualBasicCallReducer.vb (1)
15Private Shared ReadOnly s_pool As ObjectPool(Of IReductionRewriter) =
Simplification\Reducers\VisualBasicCastReducer.Rewriter.vb (1)
13Public Sub New(pool As ObjectPool(Of IReductionRewriter))
Simplification\Reducers\VisualBasicCastReducer.vb (1)
15Private Shared ReadOnly s_pool As ObjectPool(Of IReductionRewriter) =
Simplification\Reducers\VisualBasicEscapingReducer.Rewriter.vb (1)
13Public Sub New(pool As ObjectPool(Of IReductionRewriter))
Simplification\Reducers\VisualBasicEscapingReducer.vb (1)
15Private Shared ReadOnly s_pool As ObjectPool(Of IReductionRewriter) =
Simplification\Reducers\VisualBasicExtensionMethodReducer.Rewriter.vb (1)
14Public Sub New(pool As ObjectPool(Of IReductionRewriter))
Simplification\Reducers\VisualBasicExtensionMethodReducer.vb (1)
14Private Shared ReadOnly s_pool As ObjectPool(Of IReductionRewriter) =
Simplification\Reducers\VisualBasicInferredMemberNameReducer.Rewriter.vb (1)
17Public Sub New(pool As ObjectPool(Of IReductionRewriter))
Simplification\Reducers\VisualBasicInferredMemberNameReducer.vb (1)
16Private Shared ReadOnly s_pool As ObjectPool(Of IReductionRewriter) =
Simplification\Reducers\VisualBasicMiscellaneousReducer.Rewriter.vb (1)
14Public Sub New(pool As ObjectPool(Of IReductionRewriter))
Simplification\Reducers\VisualBasicMiscellaneousReducer.vb (1)
15Private Shared ReadOnly s_pool As ObjectPool(Of IReductionRewriter) =
Simplification\Reducers\VisualBasicNameReducer.Rewriter.vb (1)
14Public Sub New(pool As ObjectPool(Of IReductionRewriter))
Simplification\Reducers\VisualBasicNameReducer.vb (1)
19Private Shared ReadOnly s_pool As ObjectPool(Of IReductionRewriter) =
Simplification\Reducers\VisualBasicParenthesesReducer.Rewriter.vb (1)
13Public Sub New(pool As ObjectPool(Of IReductionRewriter))
Simplification\Reducers\VisualBasicParenthesesReducer.vb (1)
10Private Shared ReadOnly s_pool As ObjectPool(Of IReductionRewriter) =
Simplification\Reducers\VisualBasicVariableDeclaratorReducer.Rewriter.vb (1)
13Public Sub New(pool As ObjectPool(Of IReductionRewriter))
Simplification\Reducers\VisualBasicVariableDeclaratorReducer.vb (1)
18Private Shared ReadOnly s_pool As ObjectPool(Of IReductionRewriter) =
Microsoft.CodeAnalysis.Workspaces (130)
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (1)
39private static readonly ObjectPool<Stack<SyntaxNodeOrToken>> s_pool = new(() => new());
Differencing\LongestCommonSubsequence.cs (3)
18private static readonly ObjectPool<VBuffer> s_pool = new(() => new VBuffer()); 120private readonly ObjectPool<VBuffer> _bufferPool; 126public VStack(ObjectPool<VBuffer> bufferPool)
Extensions.cs (23)
17public static PooledObject<StringBuilder> GetPooledObject(this ObjectPool<StringBuilder> pool) 20public static PooledObject<Stack<TItem>> GetPooledObject<TItem>(this ObjectPool<Stack<TItem>> pool) 23public static PooledObject<Queue<TItem>> GetPooledObject<TItem>(this ObjectPool<Queue<TItem>> pool) 26public static PooledObject<HashSet<TItem>> GetPooledObject<TItem>(this ObjectPool<HashSet<TItem>> pool) 29public static PooledObject<Dictionary<TKey, TValue>> GetPooledObject<TKey, TValue>(this ObjectPool<Dictionary<TKey, TValue>> pool) 33public static PooledObject<List<TItem>> GetPooledObject<TItem>(this ObjectPool<List<TItem>> pool) 36public static PooledObject<List<TItem>> GetPooledObject<TItem>(this ObjectPool<List<TItem>> pool, out List<TItem> list) 43public static PooledObject<T> GetPooledObject<T>(this ObjectPool<T> pool) where T : class 46public static StringBuilder AllocateAndClear(this ObjectPool<StringBuilder> pool) 54public static Stack<T> AllocateAndClear<T>(this ObjectPool<Stack<T>> pool) 62public static Queue<T> AllocateAndClear<T>(this ObjectPool<Queue<T>> pool) 70public static HashSet<T> AllocateAndClear<T>(this ObjectPool<HashSet<T>> pool) 78public static Dictionary<TKey, TValue> AllocateAndClear<TKey, TValue>(this ObjectPool<Dictionary<TKey, TValue>> pool) 87public static List<T> AllocateAndClear<T>(this ObjectPool<List<T>> pool) 95public static void ClearAndFree(this ObjectPool<StringBuilder> pool, StringBuilder sb) 112public static void ClearAndFree<T>(this ObjectPool<HashSet<T>> pool, HashSet<T> set) 130public static void ClearAndFree<T>(this ObjectPool<ConcurrentSet<T>> pool, ConcurrentSet<T> set) where T : notnull 146public static void ClearAndFree<T>(this ObjectPool<Stack<T>> pool, Stack<T> set) 164public static void ClearAndFree<T>(this ObjectPool<ConcurrentStack<T>> pool, ConcurrentStack<T> stack) 180public static void ClearAndFree<T>(this ObjectPool<Queue<T>> pool, Queue<T> set) 198public static void ClearAndFree<TKey, TValue>(this ObjectPool<Dictionary<TKey, TValue>> pool, Dictionary<TKey, TValue> map) 217public static void ClearAndFree<TKey, TValue>(this ObjectPool<ConcurrentDictionary<TKey, TValue>> pool, ConcurrentDictionary<TKey, TValue> map) 234public static void ClearAndFree<T>(this ObjectPool<List<T>> pool, List<T> list)
ExternalAccess\Pythia\Api\PythiaObjectPool.cs (2)
37private static ObjectPool<T> Default<T>() where T : class, new() 42public static readonly ObjectPool<T> Instance = new(() => new T(), 20);
FindSymbols\FindReferences\DependentTypeFinder.cs (1)
49private static readonly ObjectPool<PooledHashSet<INamedTypeSymbol>> s_symbolSetPool = PooledHashSet<INamedTypeSymbol>.CreatePool(SymbolEquivalenceComparer.Instance);
FindSymbols\FindReferences\FindReferencesSearchEngine.cs (1)
23private static readonly ObjectPool<MetadataUnifyingSymbolHashSet> s_metadataUnifyingSymbolHashSetPool = new(() => new());
FindSymbols\SymbolTree\SymbolTreeInfo_Metadata.cs (2)
241private static readonly ObjectPool<List<string>> s_stringListPool = SharedPools.Default<List<string>>(); 793private static readonly ObjectPool<MetadataNode> s_pool = SharedPools.Default<MetadataNode>();
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (2)
28public static readonly ObjectPool<HashSet<string>> StringLiteralHashSetPool = SharedPools.Default<HashSet<string>>(); 29public static readonly ObjectPool<HashSet<long>> LongLiteralHashSetPool = SharedPools.Default<HashSet<long>>();
IntervalTree`1.cs (1)
29private static readonly ObjectPool<Stack<(Node? node, bool firstTime)>> s_stackPool
ISyntaxFactsExtensions.cs (1)
20private static readonly ObjectPool<Stack<(SyntaxNodeOrToken nodeOrToken, bool leading, bool trailing)>> s_stackPool
J\s\src\Dependencies\PooledObjects\ArrayBuilder.cs\ArrayBuilder.cs (7)
47private readonly ObjectPool<ArrayBuilder<T>>? _pool; 58private ArrayBuilder(ObjectPool<ArrayBuilder<T>> pool) 359var pool = _pool; 390private static readonly ObjectPool<ArrayBuilder<T>> s_poolInstance = CreatePool(); 418public static ObjectPool<ArrayBuilder<T>> CreatePool() 423public static ObjectPool<ArrayBuilder<T>> CreatePool(int size) 425ObjectPool<ArrayBuilder<T>>? pool = null;
J\s\src\Dependencies\PooledObjects\PooledDictionary.cs\PooledDictionary.cs (5)
16private readonly ObjectPool<PooledDictionary<K, V>> _pool; 18private PooledDictionary(ObjectPool<PooledDictionary<K, V>> pool, IEqualityComparer<K> keyComparer) 40private static readonly ObjectPool<PooledDictionary<K, V>> s_poolInstance = CreatePool(EqualityComparer<K>.Default); 43public static ObjectPool<PooledDictionary<K, V>> CreatePool(IEqualityComparer<K> keyComparer) 45ObjectPool<PooledDictionary<K, V>>? pool = null;
J\s\src\Dependencies\PooledObjects\PooledHashSet.cs\PooledHashSet.cs (5)
14private readonly ObjectPool<PooledHashSet<T>> _pool; 16private PooledHashSet(ObjectPool<PooledHashSet<T>> pool, IEqualityComparer<T> equalityComparer) : 29private static readonly ObjectPool<PooledHashSet<T>> s_poolInstance = CreatePool(EqualityComparer<T>.Default); 32public static ObjectPool<PooledHashSet<T>> CreatePool(IEqualityComparer<T> equalityComparer) 34ObjectPool<PooledHashSet<T>>? pool = null;
J\s\src\Dependencies\PooledObjects\PooledStringBuilder.cs\PooledStringBuilder.cs (5)
21private readonly ObjectPool<PooledStringBuilder> _pool; 23private PooledStringBuilder(ObjectPool<PooledStringBuilder> pool) 73private static readonly ObjectPool<PooledStringBuilder> s_poolInstance = CreatePool(); 81public static ObjectPool<PooledStringBuilder> CreatePool(int size = 32) 83ObjectPool<PooledStringBuilder>? pool = null;
LanguageServices\DeclaredSymbolFactoryService\AbstractDeclaredSymbolInfoFactoryService.cs (2)
36private static readonly ObjectPool<List<Dictionary<string, string>>> s_aliasMapListPool 44private static readonly ObjectPool<Dictionary<string, string>> s_aliasMapPool
Log\KeyValueLogMessage.cs (1)
20private static readonly ObjectPool<KeyValueLogMessage> s_pool = new(() => new KeyValueLogMessage(), 20);
Logger.LogBlock.cs (3)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256)); 34private readonly ObjectPool<RoslynLogBlock> _pool; 45public RoslynLogBlock(ObjectPool<RoslynLogBlock> pool)
LogMessage.cs (6)
61private static readonly ObjectPool<StaticLogMessage> s_pool = SharedPools.Default<StaticLogMessage>(); 89private static readonly ObjectPool<LazyLogMessage> s_pool = SharedPools.Default<LazyLogMessage>(); 119private static readonly ObjectPool<LazyLogMessage<TArg0>> s_pool = SharedPools.Default<LazyLogMessage<TArg0>>(); 152private static readonly ObjectPool<LazyLogMessage<TArg0, TArg1>> s_pool = SharedPools.Default<LazyLogMessage<TArg0, TArg1>>(); 188private static readonly ObjectPool<LazyLogMessage<TArg0, TArg1, TArg2>> s_pool = SharedPools.Default<LazyLogMessage<TArg0, TArg1, TArg2>>(); 227private static readonly ObjectPool<LazyLogMessage<TArg0, TArg1, TArg2, TArg3>> s_pool = SharedPools.Default<LazyLogMessage<TArg0, TArg1, TArg2, TArg3>>();
ObjectPool`1.cs (1)
118internal ObjectPool(Func<ObjectPool<T>, T> factory, int size)
ObjectReader.cs (1)
321private static readonly ObjectPool<SegmentedList<T>> s_objectListPool
ObjectWriter.cs (4)
392private static readonly ObjectPool<SegmentedDictionary<object, int>> s_referenceDictionaryPool = 395private static readonly ObjectPool<SegmentedDictionary<object, int>> s_valueDictionaryPool = 405private static ObjectPool<SegmentedDictionary<object, int>> GetDictionaryPool(bool valueEquality) 410var pool = GetDictionaryPool(_valueEquality);
OrderPreservingMultiDictionary.cs (5)
29private readonly ObjectPool<OrderPreservingMultiDictionary<K, V>>? _pool; 31private OrderPreservingMultiDictionary(ObjectPool<OrderPreservingMultiDictionary<K, V>> pool) 54private static readonly ObjectPool<OrderPreservingMultiDictionary<K, V>> s_poolInstance = CreatePool(); 57public static ObjectPool<OrderPreservingMultiDictionary<K, V>> CreatePool() 59var pool = new ObjectPool<OrderPreservingMultiDictionary<K, V>>(
PooledDelegates.cs (1)
18public static readonly ObjectPool<T> Instance = new(() => new T(), 20);
PooledObject.cs (23)
17private readonly Action<ObjectPool<T>, T> _releaser; 18private readonly ObjectPool<T> _pool; 21public PooledObject(ObjectPool<T> pool, Func<ObjectPool<T>, T> allocator, Action<ObjectPool<T>, T> releaser) : this() 40public static PooledObject<StringBuilder> Create(ObjectPool<StringBuilder> pool) 48public static PooledObject<Stack<TItem>> Create<TItem>(ObjectPool<Stack<TItem>> pool) 56public static PooledObject<Queue<TItem>> Create<TItem>(ObjectPool<Queue<TItem>> pool) 64public static PooledObject<HashSet<TItem>> Create<TItem>(ObjectPool<HashSet<TItem>> pool) 72public static PooledObject<Dictionary<TKey, TValue>> Create<TKey, TValue>(ObjectPool<Dictionary<TKey, TValue>> pool) 81public static PooledObject<List<TItem>> Create<TItem>(ObjectPool<List<TItem>> pool) 91private static StringBuilder Allocator(ObjectPool<StringBuilder> pool) 94private static void Releaser(ObjectPool<StringBuilder> pool, StringBuilder sb) 97private static Stack<TItem> Allocator<TItem>(ObjectPool<Stack<TItem>> pool) 100private static void Releaser<TItem>(ObjectPool<Stack<TItem>> pool, Stack<TItem> obj) 103private static Queue<TItem> Allocator<TItem>(ObjectPool<Queue<TItem>> pool) 106private static void Releaser<TItem>(ObjectPool<Queue<TItem>> pool, Queue<TItem> obj) 109private static HashSet<TItem> Allocator<TItem>(ObjectPool<HashSet<TItem>> pool) 112private static void Releaser<TItem>(ObjectPool<HashSet<TItem>> pool, HashSet<TItem> obj) 115private static Dictionary<TKey, TValue> Allocator<TKey, TValue>(ObjectPool<Dictionary<TKey, TValue>> pool) 119private static void Releaser<TKey, TValue>(ObjectPool<Dictionary<TKey, TValue>> pool, Dictionary<TKey, TValue> obj) 123private static List<TItem> Allocator<TItem>(ObjectPool<List<TItem>> pool) 126private static void Releaser<TItem>(ObjectPool<List<TItem>> pool, List<TItem> obj)
Serialization\SolutionReplicationContext.cs (1)
13private static readonly ObjectPool<ConcurrentSet<IDisposable>> s_pool = new(() => new());
Shared\Utilities\XmlFragmentParser.cs (1)
25private static readonly ObjectPool<XmlFragmentParser> s_pool = SharedPools.Default<XmlFragmentParser>();
SharedPools.cs (10)
25public static ObjectPool<T> BigDefault<T>() where T : class, new() 31public static ObjectPool<T> Default<T>() where T : class, new() 37public static ObjectPool<Dictionary<string, T>> StringIgnoreCaseDictionary<T>() 43public static readonly ObjectPool<HashSet<string>> StringIgnoreCaseHashSet = 49public static readonly ObjectPool<HashSet<string>> StringHashSet = 56public static readonly ObjectPool<byte[]> ByteArray = new(() => new byte[ByteBufferSize], ByteBufferCount); 57public static readonly ObjectPool<char[]> CharArray = new(() => new char[ByteBufferSize], CharBufferCount); 68public static readonly ObjectPool<T> Instance = new(() => new T(), 100); 73public static readonly ObjectPool<T> Instance = new(() => new T(), 20); 78public static readonly ObjectPool<Dictionary<string, T>> Instance =
Simplification\AbstractReducer.cs (2)
13private readonly ObjectPool<IReductionRewriter> _pool; 15protected AbstractReducer(ObjectPool<IReductionRewriter> pool)
StringTable.cs (5)
84private StringTable(ObjectPool<StringTable>? pool) 89private readonly ObjectPool<StringTable>? _pool; 90private static readonly ObjectPool<StringTable> s_staticPool = CreatePool(); 92private static ObjectPool<StringTable> CreatePool() 94var pool = new ObjectPool<StringTable>(pool => new StringTable(pool), Environment.ProcessorCount * 2);
SymbolKey.SymbolKeyReader.cs (1)
322private static readonly ObjectPool<SymbolKeyReader> s_readerPool = SharedPools.Default<SymbolKeyReader>();
SymbolKey.SymbolKeyWriter.cs (1)
55private static readonly ObjectPool<SymbolKeyWriter> s_writerPool = SharedPools.Default<SymbolKeyWriter>();
SymbolUsageAnalysis.BasicBlockAnalysisData.cs (1)
23private static readonly ObjectPool<BasicBlockAnalysisData> s_pool =
SymbolUsageAnalysis.Walker.cs (1)
32private static readonly ObjectPool<Walker> s_visitorPool = new(() => new Walker());
Workspace\Solution\Checksum_Factory.cs (1)
22private static readonly ObjectPool<IncrementalHash> s_incrementalHashPool =
Microsoft.VisualStudio.LanguageServices (2)
InheritanceMargin\InheritanceMarginHelpers.cs (1)
21private static readonly ObjectPool<MultiDictionary<string, InheritanceTargetItem>> s_pool = new(() => new());
Storage\CloudCachePersistentStorage.cs (1)
27private static readonly ObjectPool<byte[]> s_byteArrayPool = new(() => new byte[Checksum.HashSize]);