.NET Collections and the Large Object Heap (LOH)

后端 未结 4 1339
渐次进展
渐次进展 2020-12-11 02:45

Are .NET collections with large number of items apt to be stored in the LOH?

I\'m curious about List and Dictionary specifically. In my code, I store a large number

4条回答
  •  我在风中等你
    2020-12-11 03:29

    System.Collections.Generic.List is implemented as an array internally, not a linked list. And yes, if the size of the collection is large it'll be allocated on large object heap (note that the size of the array is important, if you have a small array of large reference types, it won't be allocated on LOH).

提交回复
热议问题