“Chunked” MemoryStream

前端 未结 9 871
轮回少年
轮回少年 2020-12-10 12:50

I\'m looking for the implementation of MemoryStream which does not allocate memory as one big block, but rather a collection of chunks. I want to store a few GB of data in m

9条回答
  •  攒了一身酷
    2020-12-10 13:18

    The Bing team has released RecyclableMemoryStream and wrote about it here. The benefits they cite are:

    1. Eliminate Large Object Heap allocations by using pooled buffers
    2. Incur far fewer gen 2 GCs, and spend far less time paused due to GC
    3. Avoid memory leaks by having a bounded pool size
    4. Avoid memory fragmentation
    5. Provide excellent debuggability
    6. Provide metrics for performance tracking

提交回复
热议问题