1 type derived from ObjectPool
Microsoft.CodeAnalysis (1)
DocumentationCommentId.cs (1)
22
private class ListPool<T> :
ObjectPool
<List<T>>
31 instantiations of ObjectPool
Microsoft.CodeAnalysis (31)
CodeGen\BasicBlock.cs (1)
59
return new
ObjectPool
<BasicBlock>(() => new PooledBasicBlock(), size);
Collections\CachingFactory.cs (1)
198
var pool = new
ObjectPool
<CachingIdentityFactory<TKey, TValue>>(
Collections\OrderPreservingMultiDictionary.cs (1)
60
var pool = new
ObjectPool
<OrderPreservingMultiDictionary<K, V>>(
CommandLine\AnalyzerConfigSet.cs (3)
55
new
ObjectPool
<TreeOptions.Builder>(() => ImmutableDictionary.CreateBuilder<string, ReportDiagnostic>(Section.PropertiesKeyComparer));
58
new
ObjectPool
<AnalyzerOptions.Builder>(() => ImmutableDictionary.CreateBuilder<string, string>(Section.PropertiesKeyComparer));
60
private readonly ObjectPool<List<Section>> _sectionKeyPool = new
ObjectPool
<List<Section>>(() => new List<Section>());
Diagnostic\DiagnosticBag.cs (1)
339
return new
ObjectPool
<DiagnosticBag>(() => new DiagnosticBag(), size);
DiagnosticAnalyzer\AnalyzerExecutor.AnalyzerDiagnosticReporter.cs (1)
25
new
ObjectPool
<AnalyzerDiagnosticReporter>(() => new AnalyzerDiagnosticReporter(), 10);
DocumentationComments\XmlDocumentationCommentTextReader.cs (1)
24
new
ObjectPool
<XmlDocumentationCommentTextReader>(() => new XmlDocumentationCommentTextReader(), size: 2);
InternalUtilities\BlobBuildingStream.cs (1)
20
private static readonly ObjectPool<BlobBuildingStream> s_pool = new
ObjectPool
<BlobBuildingStream>(() => new BlobBuildingStream());
InternalUtilities\StringTable.cs (1)
94
var pool = new
ObjectPool
<StringTable>(pool => new StringTable(pool), Environment.ProcessorCount * 2);
InternalUtilities\TextKeyedCache.cs (1)
86
var pool = new
ObjectPool
<TextKeyedCache<T>>(
PEWriter\PooledBlobBuilder.cs (1)
20
private static readonly ObjectPool<PooledBlobBuilder> s_chunkPool = new
ObjectPool
<PooledBlobBuilder>(() => new PooledBlobBuilder(PoolChunkSize), PoolSize);
ReferenceManager\CommonReferenceManager.Binding.cs (3)
19
new
ObjectPool
<MultiDictionary<string, (AssemblyData DefinitionData, int DefinitionIndex)>>(() => new MultiDictionary<string, (AssemblyData DefinitionData, int DefinitionIndex)>(AssemblyIdentityComparer.SimpleNameComparer));
723
private static readonly ObjectPool<Queue<AssemblyReferenceCandidate>> s_candidatesToExaminePool = new
ObjectPool
<Queue<AssemblyReferenceCandidate>>(() => new Queue<AssemblyReferenceCandidate>());
724
private static readonly ObjectPool<List<TAssemblySymbol?>> s_candidateReferencedSymbolsPool = new
ObjectPool
<List<TAssemblySymbol?>>(() => new List<TAssemblySymbol?>(capacity: 1024));
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithSimpleName.cs (2)
31
private static readonly ObjectPool<Stack<string>> s_stringStackPool = new
ObjectPool
<Stack<string>>(static () => new Stack<string>());
32
private static readonly ObjectPool<Stack<SyntaxNode>> s_nodeStackPool = new
ObjectPool
<Stack<SyntaxNode>>(static () => new Stack<SyntaxNode>());
src\Dependencies\PooledObjects\ArrayBuilder.cs (1)
495
pool = new
ObjectPool
<ArrayBuilder<T>>(() => new ArrayBuilder<T>(pool!), size);
src\Dependencies\PooledObjects\PooledDelegates.cs (1)
19
public static readonly ObjectPool<T> Instance =
new
(() => new T(), 20);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
46
pool = new
ObjectPool
<PooledDictionary<K, V>>(() => new PooledDictionary<K, V>(pool!, keyComparer), 128);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
35
pool = new
ObjectPool
<PooledHashSet<T>>(() => new PooledHashSet<T>(pool!, equalityComparer), 128);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (1)
84
pool = new
ObjectPool
<PooledStringBuilder>(() => new PooledStringBuilder(pool!), size);
Syntax\SyntaxNavigator.cs (2)
93
= new
ObjectPool
<Stack<ChildSyntaxList.Enumerator>>(() => new Stack<ChildSyntaxList.Enumerator>(), 10);
139
= new
ObjectPool
<Stack<ChildSyntaxList.Reversed.Enumerator>>(() => new Stack<ChildSyntaxList.Reversed.Enumerator>(), 10);
Syntax\SyntaxNode.Iterators.cs (2)
47
private static readonly ObjectPool<ChildSyntaxList.Enumerator[]> s_stackPool = new
ObjectPool
<ChildSyntaxList.Enumerator[]>(() => new ChildSyntaxList.Enumerator[16]);
133
private static readonly ObjectPool<SyntaxTriviaList.Enumerator[]> s_stackPool = new
ObjectPool
<SyntaxTriviaList.Enumerator[]>(() => new SyntaxTriviaList.Enumerator[16]);
Syntax\SyntaxTriviaList.cs (1)
292
new
ObjectPool
<SyntaxTriviaListBuilder>(() => SyntaxTriviaListBuilder.Create());
Text\CompositeText.cs (1)
364
= new
ObjectPool
<HashSet<SourceText>>(() => new HashSet<SourceText>(), 5);
Text\SourceText.cs (2)
33
private static readonly ObjectPool<char[]> s_charArrayPool = new
ObjectPool
<char[]>(() => new char[CharBufferSize], CharBufferCount);
34
private static readonly ObjectPool<XxHash128> s_contentHashPool = new
ObjectPool
<XxHash128>(() => new XxHash128());
69 references to ObjectPool
Microsoft.CodeAnalysis (69)
CodeGen\BasicBlock.cs (2)
56
public static readonly
ObjectPool
<BasicBlock> Pool = CreatePool(32);
57
private static
ObjectPool
<BasicBlock> CreatePool(int size)
Collections\CachingFactory.cs (5)
132
private readonly
ObjectPool
<CachingIdentityFactory<TKey, TValue>>? _pool;
146
public CachingIdentityFactory(int size, Func<TKey, TValue> valueFactory,
ObjectPool
<CachingIdentityFactory<TKey, TValue>> pool) :
196
public static
ObjectPool
<CachingIdentityFactory<TKey, TValue>> CreatePool(int size, Func<TKey, TValue> valueFactory)
198
var
pool = new ObjectPool<CachingIdentityFactory<TKey, TValue>>(
207
var
pool = _pool;
Collections\OrderPreservingMultiDictionary.cs (5)
30
private readonly
ObjectPool
<OrderPreservingMultiDictionary<K, V>>? _pool;
32
private OrderPreservingMultiDictionary(
ObjectPool
<OrderPreservingMultiDictionary<K, V>> pool)
55
private static readonly
ObjectPool
<OrderPreservingMultiDictionary<K, V>> s_poolInstance = CreatePool();
58
public static
ObjectPool
<OrderPreservingMultiDictionary<K, V>> CreatePool()
60
var
pool = new ObjectPool<OrderPreservingMultiDictionary<K, V>>(
CommandLine\AnalyzerConfigSet.cs (4)
54
private readonly
ObjectPool
<TreeOptions.Builder> _treeOptionsPool =
57
private readonly
ObjectPool
<AnalyzerOptions.Builder> _analyzerOptionsPool =
60
private readonly
ObjectPool
<List<Section>> _sectionKeyPool = new ObjectPool<List<Section>>(() => new List<Section>());
324
static void freeKey(List<Section> sectionKey,
ObjectPool
<List<Section>> pool)
Diagnostic\DiagnosticBag.cs (2)
336
private static readonly
ObjectPool
<DiagnosticBag> s_poolInstance = CreatePool(128);
337
private static
ObjectPool
<DiagnosticBag> CreatePool(int size)
DiagnosticAnalyzer\AnalyzerExecutor.AnalyzerDiagnosticReporter.cs (1)
24
private static readonly
ObjectPool
<AnalyzerDiagnosticReporter> s_objectPool =
DocumentationComments\XmlDocumentationCommentTextReader.cs (1)
23
private static readonly
ObjectPool
<XmlDocumentationCommentTextReader> s_pool =
InternalUtilities\BlobBuildingStream.cs (1)
20
private static readonly
ObjectPool
<BlobBuildingStream> s_pool = new ObjectPool<BlobBuildingStream>(() => new BlobBuildingStream());
InternalUtilities\StringTable.cs (5)
84
private StringTable(
ObjectPool
<StringTable>? pool)
89
private readonly
ObjectPool
<StringTable>? _pool;
90
private static readonly
ObjectPool
<StringTable> s_staticPool = CreatePool();
92
private static
ObjectPool
<StringTable> CreatePool()
94
var
pool = new ObjectPool<StringTable>(pool => new StringTable(pool), Environment.ProcessorCount * 2);
InternalUtilities\TextKeyedCache.cs (5)
75
private TextKeyedCache(
ObjectPool
<TextKeyedCache<T>>? pool)
81
private readonly
ObjectPool
<TextKeyedCache<T>>? _pool;
82
private static readonly
ObjectPool
<TextKeyedCache<T>> s_staticPool = CreatePool();
84
private static
ObjectPool
<TextKeyedCache<T>> CreatePool()
86
var
pool = new ObjectPool<TextKeyedCache<T>>(
PEWriter\PooledBlobBuilder.cs (1)
20
private static readonly
ObjectPool
<PooledBlobBuilder> s_chunkPool = new ObjectPool<PooledBlobBuilder>(() => new PooledBlobBuilder(PoolChunkSize), PoolSize);
ReferenceManager\CommonReferenceManager.Binding.cs (3)
18
private static readonly
ObjectPool
<MultiDictionary<string, (AssemblyData DefinitionData, int DefinitionIndex)>> s_pool =
723
private static readonly
ObjectPool
<Queue<AssemblyReferenceCandidate>> s_candidatesToExaminePool = new ObjectPool<Queue<AssemblyReferenceCandidate>>(() => new Queue<AssemblyReferenceCandidate>());
724
private static readonly
ObjectPool
<List<TAssemblySymbol?>> s_candidateReferencedSymbolsPool = new ObjectPool<List<TAssemblySymbol?>>(() => new List<TAssemblySymbol?>(capacity: 1024));
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithSimpleName.cs (2)
31
private static readonly
ObjectPool
<Stack<string>> s_stringStackPool = new ObjectPool<Stack<string>>(static () => new Stack<string>());
32
private static readonly
ObjectPool
<Stack<SyntaxNode>> s_nodeStackPool = new ObjectPool<Stack<SyntaxNode>>(static () => new Stack<SyntaxNode>());
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
56
private readonly
ObjectPool
<ArrayBuilder<T>>? _pool;
67
private ArrayBuilder(
ObjectPool
<ArrayBuilder<T>> pool)
428
var
pool = _pool;
459
private static readonly
ObjectPool
<ArrayBuilder<T>> s_poolInstance = CreatePool();
487
public static
ObjectPool
<ArrayBuilder<T>> CreatePool()
492
public static
ObjectPool
<ArrayBuilder<T>> CreatePool(int size)
494
ObjectPool
<ArrayBuilder<T>>? pool = null;
src\Dependencies\PooledObjects\ObjectPool`1.cs (1)
122
internal ObjectPool(Func<
ObjectPool
<T>, T> factory, int size)
src\Dependencies\PooledObjects\PooledDelegates.cs (1)
19
public static readonly
ObjectPool
<T> Instance = new(() => new T(), 20);
src\Dependencies\PooledObjects\PooledDictionary.cs (5)
16
private readonly
ObjectPool
<PooledDictionary<K, V>> _pool;
18
private PooledDictionary(
ObjectPool
<PooledDictionary<K, V>> pool, IEqualityComparer<K> keyComparer)
40
private static readonly
ObjectPool
<PooledDictionary<K, V>> s_poolInstance = CreatePool(EqualityComparer<K>.Default);
43
public static
ObjectPool
<PooledDictionary<K, V>> CreatePool(IEqualityComparer<K> keyComparer)
45
ObjectPool
<PooledDictionary<K, V>>? pool = null;
src\Dependencies\PooledObjects\PooledHashSet.cs (5)
14
private readonly
ObjectPool
<PooledHashSet<T>> _pool;
16
private PooledHashSet(
ObjectPool
<PooledHashSet<T>> pool, IEqualityComparer<T> equalityComparer) :
29
private static readonly
ObjectPool
<PooledHashSet<T>> s_poolInstance = CreatePool(EqualityComparer<T>.Default);
32
public static
ObjectPool
<PooledHashSet<T>> CreatePool(IEqualityComparer<T> equalityComparer)
34
ObjectPool
<PooledHashSet<T>>? pool = null;
src\Dependencies\PooledObjects\PooledStringBuilder.cs (5)
21
private readonly
ObjectPool
<PooledStringBuilder> _pool;
23
private PooledStringBuilder(
ObjectPool
<PooledStringBuilder> pool)
73
private static readonly
ObjectPool
<PooledStringBuilder> s_poolInstance = CreatePool();
81
public static
ObjectPool
<PooledStringBuilder> CreatePool(int size = 32)
83
ObjectPool
<PooledStringBuilder>? pool = null;
Syntax\SyntaxNavigator.cs (2)
92
private static readonly
ObjectPool
<Stack<ChildSyntaxList.Enumerator>> s_childEnumeratorStackPool
138
private static readonly
ObjectPool
<Stack<ChildSyntaxList.Reversed.Enumerator>> s_childReversedEnumeratorStackPool
Syntax\SyntaxNode.Iterators.cs (2)
47
private static readonly
ObjectPool
<ChildSyntaxList.Enumerator[]> s_stackPool = new ObjectPool<ChildSyntaxList.Enumerator[]>(() => new ChildSyntaxList.Enumerator[16]);
133
private static readonly
ObjectPool
<SyntaxTriviaList.Enumerator[]> s_stackPool = new ObjectPool<SyntaxTriviaList.Enumerator[]>(() => new SyntaxTriviaList.Enumerator[16]);
Syntax\SyntaxTriviaList.cs (1)
291
private static readonly
ObjectPool
<SyntaxTriviaListBuilder> s_builderPool =
Text\CompositeText.cs (1)
363
private static readonly
ObjectPool
<HashSet<SourceText>> s_uniqueSourcesPool
Text\SourceText.cs (2)
33
private static readonly
ObjectPool
<char[]> s_charArrayPool = new ObjectPool<char[]>(() => new char[CharBufferSize], CharBufferCount);
34
private static readonly
ObjectPool
<XxHash128> s_contentHashPool = new ObjectPool<XxHash128>(() => new XxHash128());