c# – 如何创建一个包含超过300万个数据的数组
发布时间:2020-12-16 02:00:35 所属栏目:百科 来源:网络整理
导读:参见英文答案 Why am I getting an Out Of Memory Exception in my C# application?????????????????????????????????????7个 using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace
参见英文答案 >
Why am I getting an Out Of Memory Exception in my C# application?????????????????????????????????????7个
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace testes { class Program { static void Main(string[] args) { Int64[] a = new Int64[300000000]; a[0] = 10; } } } 运行此代码后,我收到一个System.OutOfMemoryException但我的计算机有8千兆ram免费.请你帮助我好吗? 我是C#的初学者.我已经将编译目标cpu更改为x64,认为只有这个就足够了. 解决方法
http://msdn.microsoft.com/en-us/library/ms241064(v=vs.110).aspx
拆分数组或将其放入配置中: <configuration> <runtime> <gcAllowVeryLargeObjects enabled="true" /> </runtime> </configuration> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |