안녕하세요^^
아래와 같은 상황에 대하여 궁금한점이 발생하여 질문드립니다.
제가 알기로는 QUEUE 에 크기는 무제한이라고 알고있는데 (제 컴퓨터 기준 중간에 OUT OF MEMORY가 뜹니다)
이유가 무엇인지 궁금합니다
추가1. 소스상의 for 구문중 i 가 134217728 일때 멈춥니다.
추가2. 혹시나하고 List<int>로해도 i가 134217728 일때 멈춥니다.
사용하고 있는 visualStudio는 2015 Commnuity 버전입니다.
---------소스코드----------------using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Queue<int> test1 = new Queue<int>();
for(int i=0; i <1000000000; i++)
{
test1.Enqueue(i);
}
Console.Write("테스트");
}
}
}
----예외정보-------------------
System.OutOfMemoryException이(가) 처리되지 않았습니다.
HResult=-2147024882
Message='System.OutOfMemoryException' 형식의 예외가 Throw되었습니다.
Source=System
StackTrace:
/ System.Collections.Generic.Queue`1.SetCapacity(Int32 capacity)
/ System.Collections.Generic.Queue`1.Enqueue(T item)
/ ConsoleApplication1.Program.Main(String[] args) 파일 C:\Users\1234\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:줄 18
/ System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
/ System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
/ Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
/ System.Threading.ThreadHelper.ThreadStart_Context(Object state)
/ System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
/ System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
/ System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
/ System.Threading.ThreadHelper.ThreadStart()
InnerException:
[최초 등록일: ]
[최종 수정일: 9/17/2016]