charslaw / Pando

Pando serializes and tracks the history of a state tree
MIT License
2 stars 0 forks source link

Consider using `ArrayPool` for large byte buffers #48

Open schultzcole opened 2 years ago

schultzcole commented 2 years ago

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!

schultzcole commented 2 years ago

Would having a dedicated ArrayPool be better than using the default?