You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Right now we're using 81920 bytes as a streaming threshold:
npgsql/src/Npgsql/Internal/Converters/JsonConverter.cs
Line 111 in 62dcf21
The problem with this is, we use
ArrayPool<byte>.Sharedto 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