Right now we're using 81920 bytes as a streaming threshold:
|
const int StreamingThreshold = 81920; |
The problem with this is, we use ArrayPool<byte>.Shared to get temporary buffers, and in case we pass a length larger than 65536, it's going to allocate a 130kb buffer, which is much larger than LOH threshold. It's usually not that big of a deal since we're going to reuse these buffers anyway, but in case of memory pressure it's probably better if that array will be in Gen 2 rather than LOH.
cc @NinoFloris