FC73: SmallArrayPool<T>

Simple replacement for ArrayPool<T>

There are two places in FrugalLib where ArrayPool is used which I do not really like, because it could hold too many buffers. A simpler implementation with limited number of buffers would be better. I’m adding a SmallArrayPool as replacement:

SimpleArrayPool has a singleton instance and array of N-1 buffers. Rent is implemented using Interlocked.Exchange. Small arrays will gradually be replaced by larger arrays to need demands. It provides APIs to query maximum buffer length and total buffer length, so that application can know its memory usage and determine if trimming is needed.

Here is how it’s getting used:

Another reason to replace ArrayPool is I’m trying to use FrugalLib.dll in my modified version of PerfView, so reducing assembly dependency is a good thing.