Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit 79c4a42

Browse files
committed
Use default value in constructor
1 parent 9f82d21 commit 79c4a42

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/Microsoft.AspNet.Server.Kestrel/Http/Frame.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public async Task RequestProcessingAsync()
231231

232232
await ProduceEnd();
233233

234-
var block = Memory2.Lease(MemoryPool2.DefaultBlockLength);
234+
var block = Memory2.Lease();
235235
try
236236
{
237237
var segment = block.Data;
@@ -788,7 +788,7 @@ public static bool TakeMessageHeaders(SocketInput input, FrameRequestHeaders req
788788
continue;
789789
}
790790

791-
var block = memorypool.Lease(MemoryPool2.DefaultBlockLength);
791+
var block = memorypool.Lease();
792792
try
793793
{
794794
var name = beginName.GetArraySegment(endName, block.Data);

src/Microsoft.AspNet.Server.Kestrel/Infrastructure/MemoryPool2.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ public class MemoryPool2 : IDisposable
3232
private const int _blockLength = _blockStride - _blockUnused;
3333

3434
/// <summary>
35-
/// Default allocation block size for pooled blocks.
35+
/// Max allocation block size for pooled blocks,
36+
/// larger values can be leased but they will be disposed after use rather than returned to the pool.
3637
/// </summary>
37-
public const int DefaultBlockLength = _blockLength;
38-
39-
38+
public const int MaxPooledBlockLength = _blockLength;
39+
4040
/// <summary>
4141
/// 4096 * 32 gives you a slabLength of 128k contiguous bytes allocated per slab
4242
/// </summary>
@@ -65,7 +65,7 @@ public class MemoryPool2 : IDisposable
6565
/// <param name="minimumSize">The block returned must be at least this size. It may be larger than this minimum size, and if so,
6666
/// the caller may write to the block's entire size rather than being limited to the minumumSize requested.</param>
6767
/// <returns>The block that is reserved for the called. It must be passed to Return when it is no longer being used.</returns>
68-
public MemoryPoolBlock2 Lease(int minimumSize)
68+
public MemoryPoolBlock2 Lease(int minimumSize = MaxPooledBlockLength)
6969
{
7070
if (minimumSize > _blockLength)
7171
{

0 commit comments

Comments
 (0)