.NET Garbage Collector mystery

后端 未结 4 808
無奈伤痛
無奈伤痛 2021-01-30 22:42

In my job we had a problem with OutOfMemoryExceptions. I\'ve written a simple piece of code to mimic some behavior, and I\'ve ended up with the following mystery. Look at this s

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-30 23:08

    Depending on the CLR you're using, there may be some Large Object Heap issues involved.

    Have a look at this article, which explains the issues with large block allocations (and the list with 200000 items is a large block for sure, the other may or may not be, some arrays seem to be put into LOH when they reach 8k, others after 85k).

    http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-object-heap/

提交回复
热议问题