38 instantiations of ObjectPool
Microsoft.CodeAnalysis.Workspaces (38)
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (2)
31private static readonly ObjectPool<SegmentedList<ClassifiedSpan>> s_listPool = new(() => []); 32private static readonly ObjectPool<Stack<SyntaxNodeOrToken>> s_stackPool = new(() => new(), trimOnFree: false);
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (2)
38private static readonly ObjectPool<Stack<ChildSyntaxList.Enumerator>> s_enumeratorPool = new(() => new()); 39private static readonly ObjectPool<Stack<ChildSyntaxList.Reversed.Enumerator>> s_reversedEnumeratorPool = new(() => new());
Differencing\LongestCommonSubsequence.cs (1)
25private 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)
36private static readonly ObjectPool<Dictionary<ISymbol, SymbolGroup>> s_symbolToGroupPool = new(() => new(MetadataUnifyingEquivalenceComparer.Instance));
FindSymbols\FindReferences\MetadataUnifyingSymbolHashSet.cs (1)
12private static readonly ObjectPool<MetadataUnifyingSymbolHashSet> s_metadataUnifyingSymbolHashSetPool = new(() => []);
FindSymbols\SymbolTree\SymbolTreeInfo_Source.cs (1)
19private static readonly ObjectPool<MultiDictionary<string, INamespaceOrTypeSymbol>> s_symbolMapPool = new(() => []);
Log\KeyValueLogMessage.cs (1)
20private static readonly ObjectPool<KeyValueLogMessage> s_pool = new(() => new KeyValueLogMessage(), 20);
Shared\Extensions\SourceTextExtensions.cs (1)
33private static readonly ObjectPool<char[]> s_charArrayPool = new(() => new char[CharArrayLength], ObjectPoolCount);
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (1)
60var pool = new ObjectPool<OrderPreservingMultiDictionary<K, V>>(
src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (1)
94var pool = new ObjectPool<StringTable>(pool => new StringTable(pool), Environment.ProcessorCount * 2);
src\Dependencies\PooledObjects\ArrayBuilder.cs (1)
495pool = new ObjectPool<ArrayBuilder<T>>(() => new ArrayBuilder<T>(pool!), size);
src\Dependencies\PooledObjects\PooledDelegates.cs (1)
19public static readonly ObjectPool<T> Instance = new(() => new T(), 20);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
46pool = new ObjectPool<PooledDictionary<K, V>>(() => new PooledDictionary<K, V>(pool!, keyComparer), 128);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
35pool = new ObjectPool<PooledHashSet<T>>(() => new PooledHashSet<T>(pool!, equalityComparer), 128);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (1)
84pool = new ObjectPool<PooledStringBuilder>(() => new PooledStringBuilder(pool!), size);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.cs (1)
37private static readonly ObjectPool<Stack<TNode>> s_nodeStackPool = new(() => new(), 128, trimOnFree: false);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
852private static readonly ObjectPool<Stack<TDirectiveTriviaSyntax>> s_stackPool = new(() => new());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.BasicBlockAnalysisData.cs (1)
24new(() => new BasicBlockAnalysisData());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
32private static readonly ObjectPool<Walker> s_visitorPool = new(() => new Walker());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
36private static readonly ObjectPool<SegmentedList<TokenPairWithOperations>> s_tokenPairListPool = new(() => [], trimOnFree: false);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\NodeOperations.cs (4)
17private static readonly ObjectPool<SegmentedList<IndentBlockOperation>> s_indentBlockOperationPool = new(() => []); 18private static readonly ObjectPool<SegmentedList<SuppressOperation>> s_suppressOperationPool = new(() => []); 19private static readonly ObjectPool<SegmentedList<AlignTokensOperation>> s_alignTokensOperationPool = new(() => []); 20private static readonly ObjectPool<SegmentedList<AnchorIndentationOperation>> s_anchorIndentationOperationPool = new(() => []);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\ObjectPools\SharedPools.cs (6)
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); 64public static readonly ObjectPool<T> Instance = new(() => new T(), 100); 69public static readonly ObjectPool<T> Instance = new(() => new T(), 20); 75new(() => new Dictionary<string, T>(StringComparer.OrdinalIgnoreCase), 20);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.ReaderReferenceMap.cs (1)
21= new(() => new SegmentedList<string>(20));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
27public static ObjectPool<T[]> Shared = new(() => new T[BufferSize], 512);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.WriterReferenceMap.cs (1)
22private static readonly ObjectPool<SegmentedDictionary<string, int>> s_valueDictionaryPool = new(() => new(128));
Workspace\Solution\Checksum_Factory.cs (1)
24new(() => new(), size: 20);
Workspace\Solution\ProjectDependencyGraph.cs (1)
60private static readonly ObjectPool<ImmutableHashSet<ProjectId>.Builder> s_reverseReferencesBuilderPool = new(static () => ImmutableHashSet.CreateBuilder<ProjectId>(), size: 256);
157 references to ObjectPool
Microsoft.CodeAnalysis.Workspaces (157)
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (2)
31private static readonly ObjectPool<SegmentedList<ClassifiedSpan>> s_listPool = new(() => []); 32private static readonly ObjectPool<Stack<SyntaxNodeOrToken>> s_stackPool = new(() => new(), trimOnFree: false);
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (2)
38private static readonly ObjectPool<Stack<ChildSyntaxList.Enumerator>> s_enumeratorPool = new(() => new()); 39private static readonly ObjectPool<Stack<ChildSyntaxList.Reversed.Enumerator>> s_reversedEnumeratorPool = new(() => new());
Differencing\LongestCommonSubsequence.cs (3)
25private static readonly ObjectPool<VBuffer> s_pool = new(() => new VBuffer()); 141private readonly ObjectPool<VBuffer> _bufferPool; 147public VStack(ObjectPool<VBuffer> bufferPool)
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)
36private static readonly ObjectPool<Dictionary<ISymbol, SymbolGroup>> s_symbolToGroupPool = new(() => new(MetadataUnifyingEquivalenceComparer.Instance));
FindSymbols\FindReferences\MetadataUnifyingSymbolHashSet.cs (1)
12private static readonly ObjectPool<MetadataUnifyingSymbolHashSet> s_metadataUnifyingSymbolHashSetPool = new(() => []);
FindSymbols\SymbolTree\SymbolTreeInfo_Metadata.cs (2)
254private static readonly ObjectPool<List<string>> s_stringListPool = SharedPools.Default<List<string>>(); 790private static readonly ObjectPool<MetadataNode> s_pool = SharedPools.Default<MetadataNode>();
FindSymbols\SymbolTree\SymbolTreeInfo_Source.cs (1)
19private static readonly ObjectPool<MultiDictionary<string, INamespaceOrTypeSymbol>> s_symbolMapPool = new(() => []);
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (2)
26public static readonly ObjectPool<HashSet<string>> StringLiteralHashSetPool = SharedPools.Default<HashSet<string>>(); 27public static readonly ObjectPool<HashSet<long>> LongLiteralHashSetPool = SharedPools.Default<HashSet<long>>();
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);
Shared\Extensions\SourceTextExtensions.cs (1)
33private static readonly ObjectPool<char[]> s_charArrayPool = new(() => new char[CharArrayLength], ObjectPoolCount);
Shared\Utilities\XmlFragmentParser.cs (1)
25private static readonly ObjectPool<XmlFragmentParser> s_pool = SharedPools.Default<XmlFragmentParser>();
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (5)
30private readonly ObjectPool<OrderPreservingMultiDictionary<K, V>>? _pool; 32private OrderPreservingMultiDictionary(ObjectPool<OrderPreservingMultiDictionary<K, V>> pool) 55private static readonly ObjectPool<OrderPreservingMultiDictionary<K, V>> s_poolInstance = CreatePool(); 58public static ObjectPool<OrderPreservingMultiDictionary<K, V>> CreatePool() 60var pool = new ObjectPool<OrderPreservingMultiDictionary<K, V>>(
src\Compilers\Core\Portable\InternalUtilities\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);
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
56private readonly ObjectPool<ArrayBuilder<T>>? _pool; 67private ArrayBuilder(ObjectPool<ArrayBuilder<T>> pool) 428var pool = _pool; 459private static readonly ObjectPool<ArrayBuilder<T>> s_poolInstance = CreatePool(); 487public static ObjectPool<ArrayBuilder<T>> CreatePool() 492public static ObjectPool<ArrayBuilder<T>> CreatePool(int size) 494ObjectPool<ArrayBuilder<T>>? pool = null;
src\Dependencies\PooledObjects\ObjectPool`1.cs (1)
122internal ObjectPool(Func<ObjectPool<T>, T> factory, int size)
src\Dependencies\PooledObjects\PooledDelegates.cs (1)
19public static readonly ObjectPool<T> Instance = new(() => new T(), 20);
src\Dependencies\PooledObjects\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;
src\Dependencies\PooledObjects\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;
src\Dependencies\PooledObjects\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;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.cs (1)
37private static readonly ObjectPool<Stack<TNode>> s_nodeStackPool = new(() => new(), 128, trimOnFree: false);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
852private static readonly ObjectPool<Stack<TDirectiveTriviaSyntax>> s_stackPool = new(() => new());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.BasicBlockAnalysisData.cs (1)
23private static readonly ObjectPool<BasicBlockAnalysisData> s_pool =
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (1)
32private static readonly ObjectPool<Walker> s_visitorPool = new(() => new Walker());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
36private static readonly ObjectPool<SegmentedList<TokenPairWithOperations>> s_tokenPairListPool = new(() => [], trimOnFree: false);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\NodeOperations.cs (4)
17private static readonly ObjectPool<SegmentedList<IndentBlockOperation>> s_indentBlockOperationPool = new(() => []); 18private static readonly ObjectPool<SegmentedList<SuppressOperation>> s_suppressOperationPool = new(() => []); 19private static readonly ObjectPool<SegmentedList<AlignTokensOperation>> s_alignTokensOperationPool = new(() => []); 20private static readonly ObjectPool<SegmentedList<AnchorIndentationOperation>> s_anchorIndentationOperationPool = new(() => []);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (2)
17private static readonly ObjectPool<RoslynLogBlock> s_pool = new(() => new RoslynLogBlock(s_pool!), Math.Min(Environment.ProcessorCount * 8, 256)); 32private sealed class RoslynLogBlock(ObjectPool<RoslynLogBlock> pool) : IDisposable
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\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>>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\ObjectPools\Extensions.cs (35)
18public static PooledObject<StringBuilder> GetPooledObject(this ObjectPool<StringBuilder> pool) 21public static PooledObject<StringBuilder> GetPooledObject(this ObjectPool<StringBuilder> pool, out StringBuilder builder) 28public static PooledObject<Stack<TItem>> GetPooledObject<TItem>(this ObjectPool<Stack<TItem>> pool) 31public static PooledObject<Queue<TItem>> GetPooledObject<TItem>(this ObjectPool<Queue<TItem>> pool) 34public static PooledObject<HashSet<TItem>> GetPooledObject<TItem>(this ObjectPool<HashSet<TItem>> pool) 37public static PooledObject<Dictionary<TKey, TValue>> GetPooledObject<TKey, TValue>(this ObjectPool<Dictionary<TKey, TValue>> pool) where TKey : notnull 40public static PooledObject<List<TItem>> GetPooledObject<TItem>(this ObjectPool<List<TItem>> pool) 43public static PooledObject<SegmentedList<TItem>> GetPooledObject<TItem>(this ObjectPool<SegmentedList<TItem>> pool) 46public static PooledObject<Stack<TItem>> GetPooledObject<TItem>(this ObjectPool<Stack<TItem>> pool, out Stack<TItem> stack) 53public static PooledObject<List<TItem>> GetPooledObject<TItem>(this ObjectPool<List<TItem>> pool, out List<TItem> list) 60public static PooledObject<SegmentedList<TItem>> GetPooledObject<TItem>(this ObjectPool<SegmentedList<TItem>> pool, out SegmentedList<TItem> list) 67public static PooledObject<HashSet<TItem>> GetPooledObject<TItem>(this ObjectPool<HashSet<TItem>> pool, out HashSet<TItem> set) 74public static PooledObject<Dictionary<TKey, TValue>> GetPooledObject<TKey, TValue>(this ObjectPool<Dictionary<TKey, TValue>> pool, out Dictionary<TKey, TValue> dictionary) 82public static PooledObject<ConcurrentSet<T>> GetPooledObject<T>(this ObjectPool<ConcurrentSet<T>> pool, out ConcurrentSet<T> set) 90public static PooledObject<T> GetPooledObject<T>(this ObjectPool<T> pool) where T : class 93public static StringBuilder AllocateAndClear(this ObjectPool<StringBuilder> pool) 101public static Stack<T> AllocateAndClear<T>(this ObjectPool<Stack<T>> pool) 109public static Queue<T> AllocateAndClear<T>(this ObjectPool<Queue<T>> pool) 117public static HashSet<T> AllocateAndClear<T>(this ObjectPool<HashSet<T>> pool) 125public static ConcurrentSet<T> AllocateAndClear<T>(this ObjectPool<ConcurrentSet<T>> pool) where T : notnull 133public static SegmentedHashSet<T> AllocateAndClear<T>(this ObjectPool<SegmentedHashSet<T>> pool) 141public static Dictionary<TKey, TValue> AllocateAndClear<TKey, TValue>(this ObjectPool<Dictionary<TKey, TValue>> pool) 150public static List<T> AllocateAndClear<T>(this ObjectPool<List<T>> pool) 158public static SegmentedList<T> AllocateAndClear<T>(this ObjectPool<SegmentedList<T>> pool) 166public static void ClearAndFree(this ObjectPool<StringBuilder> pool, StringBuilder sb) 183public static void ClearAndFree<T>(this ObjectPool<HashSet<T>> pool, HashSet<T> set) 201public static void ClearAndFree<T>(this ObjectPool<SegmentedHashSet<T>> pool, SegmentedHashSet<T> set) 219public static void ClearAndFree<T>(this ObjectPool<ConcurrentSet<T>> pool, ConcurrentSet<T> set) where T : notnull 235public static void ClearAndFree<T>(this ObjectPool<Stack<T>> pool, Stack<T> stack) 249public static void ClearAndFree<T>(this ObjectPool<ConcurrentStack<T>> pool, ConcurrentStack<T> stack) 265public static void ClearAndFree<T>(this ObjectPool<Queue<T>> pool, Queue<T> set) 283public static void ClearAndFree<TKey, TValue>(this ObjectPool<Dictionary<TKey, TValue>> pool, Dictionary<TKey, TValue> map) 302public static void ClearAndFree<TKey, TValue>(this ObjectPool<ConcurrentDictionary<TKey, TValue>> pool, ConcurrentDictionary<TKey, TValue> map) 319public static void ClearAndFree<T>(this ObjectPool<List<T>> pool, List<T> list, bool trim = true) 336public static void ClearAndFree<T>(this ObjectPool<SegmentedList<T>> pool, SegmentedList<T> list, bool trim = true)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\ObjectPools\PooledObject.cs (29)
19private readonly Action<ObjectPool<T>, T> _releaser; 20private readonly ObjectPool<T> _pool; 22public PooledObject(ObjectPool<T> pool, Func<ObjectPool<T>, T> allocator, Action<ObjectPool<T>, T> releaser) : this() 41public static PooledObject<StringBuilder> Create(ObjectPool<StringBuilder> pool) 49public static PooledObject<Stack<TItem>> Create<TItem>(ObjectPool<Stack<TItem>> pool) 57public static PooledObject<Queue<TItem>> Create<TItem>(ObjectPool<Queue<TItem>> pool) 65public static PooledObject<HashSet<TItem>> Create<TItem>(ObjectPool<HashSet<TItem>> pool) 73public static PooledObject<ConcurrentSet<TItem>> Create<TItem>(ObjectPool<ConcurrentSet<TItem>> pool) where TItem : notnull 81public static PooledObject<Dictionary<TKey, TValue>> Create<TKey, TValue>(ObjectPool<Dictionary<TKey, TValue>> pool) 90public static PooledObject<List<TItem>> Create<TItem>(ObjectPool<List<TItem>> pool) 98public static PooledObject<SegmentedList<TItem>> Create<TItem>(ObjectPool<SegmentedList<TItem>> pool) 109private static StringBuilder Allocator(ObjectPool<StringBuilder> pool) 112private static void Releaser(ObjectPool<StringBuilder> pool, StringBuilder sb) 115private static Stack<TItem> Allocator<TItem>(ObjectPool<Stack<TItem>> pool) 118private static void Releaser<TItem>(ObjectPool<Stack<TItem>> pool, Stack<TItem> obj) 121private static Queue<TItem> Allocator<TItem>(ObjectPool<Queue<TItem>> pool) 124private static void Releaser<TItem>(ObjectPool<Queue<TItem>> pool, Queue<TItem> obj) 127private static HashSet<TItem> Allocator<TItem>(ObjectPool<HashSet<TItem>> pool) 130private static ConcurrentSet<TItem> Allocator<TItem>(ObjectPool<ConcurrentSet<TItem>> pool) where TItem : notnull 133private static void Releaser<TItem>(ObjectPool<HashSet<TItem>> pool, HashSet<TItem> obj) 136private static void Releaser<TItem>(ObjectPool<ConcurrentSet<TItem>> pool, ConcurrentSet<TItem> obj) where TItem : notnull 139private static Dictionary<TKey, TValue> Allocator<TKey, TValue>(ObjectPool<Dictionary<TKey, TValue>> pool) 143private static void Releaser<TKey, TValue>(ObjectPool<Dictionary<TKey, TValue>> pool, Dictionary<TKey, TValue> obj) 147private static List<TItem> Allocator<TItem>(ObjectPool<List<TItem>> pool) 150private static void Releaser<TItem>(ObjectPool<List<TItem>> pool, List<TItem> obj) 153private static SegmentedList<TItem> Allocator<TItem>(ObjectPool<SegmentedList<TItem>> pool) 156private static void Releaser<TItem>(ObjectPool<SegmentedList<TItem>> pool, SegmentedList<TItem> obj)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\ObjectPools\SharedPools.cs (9)
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); 64public static readonly ObjectPool<T> Instance = new(() => new T(), 100); 69public static readonly ObjectPool<T> Instance = new(() => new T(), 20); 74public static readonly ObjectPool<Dictionary<string, T>> Instance =
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.ReaderReferenceMap.cs (1)
20private static readonly ObjectPool<SegmentedList<string>> s_objectListPool
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
27public static ObjectPool<T[]> Shared = new(() => new T[BufferSize], 512);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.WriterReferenceMap.cs (1)
22private static readonly ObjectPool<SegmentedDictionary<string, int>> s_valueDictionaryPool = new(() => new(128));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
20private static readonly ObjectPool<Stack<(SyntaxNodeOrToken nodeOrToken, bool leading, bool trailing)>> s_stackPool
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
322private static readonly ObjectPool<SymbolKeyReader> s_readerPool = SharedPools.Default<SymbolKeyReader>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
56private static readonly ObjectPool<SymbolKeyWriter> s_writerPool = SharedPools.Default<SymbolKeyWriter>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (1)
53private static readonly ObjectPool<char[]> s_pool = new ObjectPool<char[]>(() => new char[PooledArraySize]);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractReducer.cs (2)
13private readonly ObjectPool<IReductionRewriter> _pool; 15protected AbstractReducer(ObjectPool<IReductionRewriter> pool)
Workspace\Solution\Checksum_Factory.cs (1)
23private static readonly ObjectPool<XxHash128> s_incrementalHashPool =
Workspace\Solution\ProjectDependencyGraph.cs (1)
60private static readonly ObjectPool<ImmutableHashSet<ProjectId>.Builder> s_reverseReferencesBuilderPool = new(static () => ImmutableHashSet.CreateBuilder<ProjectId>(), size: 256);