List< double>中的OutOfMemoryException当添加超过60万的价值 [英] OutOfMemoryException in List<double> when add more than 60 million value

查看:94
本文介绍了List< double>中的OutOfMemoryException当添加超过60万的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在列表中添加超过6000万个double值时,应用程序会抛出OutOfMememery异常。我在下面的系统环境中使用过这个。 


VS 2015更新2. 


Windows 10 64位(10.0,Build 10586) 。 


RAM-8GB

 List< double> list = new List< double>(); 
for(int i = 1; i< 67108870; i ++)
list.Add(i);

你能解释为什么这个例外扔了,我怎么解决这个问题?





解决方案

似乎 67108870 * sizeof(double)超出了你的内存量应用程序可以访问。


尝试增加
堆分配


When i try to add more than 60 million double values in list, application throws OutOfMememery exception. I used this in below system environment. 

VS 2015 update 2. 

Windows 10 64-bit(10.0, Build 10586). 

RAM-8GB

 List<double> list = new List<double>();
 for (int i = 1; i < 67108870; i++)
      list.Add(i);

Can you please explain why this exception thrown and how can i resolve this?


解决方案

It would seem that 67108870 * sizeof(double) exceeds the amount of memory that your application has access to.

Try increasing your heap allocation.


这篇关于List&lt; double&gt;中的OutOfMemoryException当添加超过60万的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆