[ACCEPTED]-Stack capacity in C#-stack
The default stack size for a .NET application 11 is 1 MB (default is 256 KB for 32-bit ASP.NET 10 apps and 512 KB for 64-bit ASP.NET apps), but 9 you can change that. For the application 8 you can change the default size by modifying 7 the PE header of the executable. For threads 6 you create, you can use the constructor 5 overload that takes a stack size.
But as 4 Anton Tyjhyy points out in his answer, arrays 3 are reference types and thus located on 2 the heap (even if the array happens to hold 1 a bunch of value types).
Your array will live on the heap, stack 1 size is irrelevant in your case.
If you want to check the value for your 9 current .NET assembly then you can do so 8 by using ILDASM
command that comes in with Visual 7 Studio command prompt. Once you have started 6 the tool, open your assembly and then go 5 to View -> Headers
menu. Now scroll down to PE Optional Header (32 bit)
section in 4 the newly opened Headers
window. You will see two 3 fields:
- Size of stack reserve - This is self-explanatory. This is default stack memory size allocated to any thread getting created in your program/application.
- Size of stack commit - committed stack space is - (Quoting Hans Passant from here)
The said space is reserved in the 2 operating system's paging file so the 1 stack can always be swapped out when necessary.
To use stack for storing an array you have 3 to use unsafe code with pointers and stackalloc 2 to allocate desired memory space on the 1 stack.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.