【发布时间】:2014-04-15 22:06:51
【问题描述】:
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 千兆的可用内存。你能帮帮我吗?
我是 C# 的初学者。我已经将编译目标 cpu 更改为 x64,认为只有这样就足够了。 谢谢 卢克
【问题讨论】:
-
gcAllowVeryLargeObjects - msdn.microsoft.com/en-us/library/hh285054%28v=vs.110%29.aspx
-
问题不只是内存,而是连续内存的使用:stackoverflow.com/questions/4059363/…
标签: c# memory-management out-of-memory