There are some circumstances where we may accidentally be allocating huge byte buffers on the stack using stackalloc. For very large buffer sizes, using ArrayPool would probably be preferred.
First example that comes to mind is StreamUtils.NodeData.PopulateNodeData, which currently uses a stack allocated buffer of up to 500KB!
There are some circumstances where we may accidentally be allocating huge byte buffers on the stack using
stackalloc
. For very large buffer sizes, usingArrayPool
would probably be preferred.First example that comes to mind is
StreamUtils.NodeData.PopulateNodeData
, which currently uses a stack allocated buffer of up to 500KB!