.Net Stack Size 변경 방법
※주의※
기본 Stack Size(1mb)를 변경하는것은 위험한 처리이므로 되도록 로직에서 해결해야한다.
필자는 특수한 케이스로 대량의 데이터를 인식하는 부분에서 로직으로 해결불가능한 부분이 많이 존재하여 StackSize를 증가하는 테스트를 진행하였음.
C/C++
C/C++은 프로젝트 속성에서 변경 가능
스택 예약크기를 변경하면 가능 (Default: 1MB)
---------------------------------------------------------------------------
C#
C# 은 기본적으로 변경 불가능 하므로 EDITBIN.EXE 를 이용
(없다면 아래 C++ 컴포넌트 추가 설치)
editbin.exe 의 위치를 찾는다. (툴사용추천 - https://www.voidtools.com/)
(C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64\editbin.exe)
개발자 명령프롬프트 실행
변경할 프로젝트의 bin폴더로 이동 후 아래와같이 입력
"<full path of editbin.exe>" /stack:<stack size in bytes, decimal> <your executable name>
ex)
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\editbin.exe" /stack:4194304 TestProgram.exe
(4MB)
스택 크기를 자동으로 설정
빌드 이벤트 - 빌드 후 이벤트에 추가(빌드시마다 자동 설정)
"<full path of editbin.exe>" /stack:<stack size in bytes, decimal> "$(TargetPath)"
ex)
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\editbin.exe" /stack:4194304 "$(TargetPath)"
참고
https://stackoverflow.com/questions/54584224/is-there-a-way-to-increase-the-stack-size-in-c
Is there a way to increase the stack size in c#?
I'm coming back to programming after having done none for several years, and created a Sudoku game to get my feet wet again. I've written a recursive function to brute-force a solution, and it will...
stackoverflow.com
'C# .Net' 카테고리의 다른 글
TCP/IP 통신 Server 및 Client 예제 in C# (Winform) (0) | 2022.09.20 |
---|---|
RESTful API Server 구현 예제 in C# (0) | 2022.09.19 |
A, B, C, D, ... Z, AA, AB, AC, ... AZ, BA, BB, ... ZZ, AAA, AAB... 등 알파벳 이름 자동 생성 in C# (Excel 방식) 예제 (0) | 2022.09.14 |
Json / Xml to DataSet (0) | 2022.02.25 |