OutOfMemoryException on declaration of Large Array

前端 未结 4 1520
渐次进展
渐次进展 2020-11-29 07:41

I have to create a fairly large double array 12000ish x 55000ish. Unfortunately, I get an out of memory exception. I used to develop in Java and could change the memory sett

4条回答
  •  半阙折子戏
    2020-11-29 08:22

    Providing that your total memory is sufficient, you can prevent Out of memory exceptions resulting from LOH fragmentation by creating a bunch of smaller arrays, and wrapping them in a single IList, or some other indexed interface.

    Here is a link which describes it:

    BigArray, getting around the 2GB array size limit

    Credits: this post (C# chunked array).

提交回复
热议问题