I understand that the default max stack size on ASP.NET was decreased to 256K instead of 1MB (see http://support.microsoft.com/kb/932909), how can I get it back to 1MB?
You may need to increase the stack size if your program gets stack-overflow messages at runtime. You can also set the stack size by: Using the /STACK linker option. For more information, see /STACK (Stack allocations).
In Microsoft Windows 2000, if the Microsoft ASP.NET Worker Process (ASPNet_wp.exe) creates a thread, the maximum stack size of the thread is 1 MB. In Windows Server 2008 and higher, the maximum stack size of a thread running on 32-bit version of IIS is 256 KB, and on an x64 server is 512 KB.
Because all threads in a process share the same address space, they have to divide it between them. And after the operating system has taken its part, there is "only" 2-3 GB left for an application. And that size is the limit for both the physical and the virtual memory, because there just aren't any more addresses.
You can use editbin, as described in this article.
Another solution could be that of creating an explicit new thread to perform the operations where you're getting a stack overflow error
Thread t = new Thread(Run, 4194304); // 4M of stack size
t.Start();
t.Join();
if (loadException != null) throw loadException;
void Run()
{
try
{
// Operation causing stack overflow
}
catch (Exception e)
{
...
}
}
Regards
Massimo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With