class Node
{
public Node next;
public int data;
public Node(int d)
{
this.data = d;
}
}
class Program
{
static void Main(string[] args)
{
Node n1 = new Node(10);
Node n2 = null;
Node root = n1;
int count = 1;
while (count < Int32.MaxValue -1)
{
n2 = new Node(count); //Exception
n1.next = n2;
n1 = n2;
count++;
}
}
当系统内存达到 3 of 16GB 时发生异常