BaseLibrary.IO.MemoryBufferPool located in the EPiServer.BaseLibrary assembly is a class that implements a reuse able memory area to minimal impact of objects in the large object heap.
Remarks:
This function isn’t so useful when .Net 4.0 has the functionality System.IO.Stream => CopyTo(Stream)
*This functionality is not documented and probably not supported by EPiServer*
try
{
byte[] buffer = MemoryBufferPool.Instance.Allocate();
// Use the buffer eg. fileStream.Read(buffer, offset, buffer.Length- offset);
}
finally
{
MemoryBufferPool.Instance.Release(buffer);
}