File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,17 +7,15 @@ internal class BaseArrayPoolProvider<T> : IArrayPoolProvider<T>
77 {
88 private readonly int maxSetCapacity ;
99 private readonly int maxArrayLength ;
10-
1110 private readonly T [ ] empty ;
1211 private readonly Stack < T [ ] > [ ] pooledArrays ;
1312
14- public BaseArrayPoolProvider ( )
13+ public BaseArrayPoolProvider ( int poolCapacity , int arrayMaxLength )
1514 {
16- maxSetCapacity = 100 ;
17- maxArrayLength = 50 ;
15+ maxSetCapacity = poolCapacity ;
16+ maxArrayLength = arrayMaxLength ;
1817 // ReSharper disable once VirtualMemberCallInConstructor
1918 empty = InstantiateArray ( 0 ) ;
20-
2119 pooledArrays = new Stack < T [ ] > [ maxArrayLength ] ;
2220
2321 for ( int i = 0 ; i < pooledArrays . Length ; i ++ )
@@ -26,6 +24,10 @@ public BaseArrayPoolProvider()
2624 }
2725 }
2826
27+ public BaseArrayPoolProvider ( ) : this ( 100 , 50 )
28+ {
29+ }
30+
2931 public T [ ] Take ( ) => empty ;
3032
3133 public T [ ] Take ( int length )
You can’t perform that action at this time.
0 commit comments