Error when Dictionary count is bigger as 89478457

核能气质少年 提交于 2019-12-04 22:54:43
Evk

There is known limitation of .NET runtime - maximum object size allowed on the heap is 2 GB, even on 64-bit version of runtime. But, starting from .NET 4.5 there is configuration option which allows you to relax this limit (only on 64-bit version of runtime still) and create larger arrays. Example of configuration to enable that is:

<configuration>
  <runtime>
    <gcAllowVeryLargeObjects enabled="true" />
  </runtime>
</configuration>

On the surface Dictionary does not make sense
You can only have int unique values
Do you really have that my duplicates

UnInt32 goes to 4,294,967,295
Why are you wasting 4 bytes?

89,478,458 rows Currently a row is 12 bytes
You have 1 GB at about 83,333,333 rows
Since an object needs contiguous memory 1 GB is more of a practical limit

If values is really a strut 24
Then 1 gb in 31,250,000

That is just a really big collection

You can split is up into more than one collection

Or use a class as then it is just a reference with I think is 4 bytes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!