.net - How do you change default stack size for managed executable.net -


We've found that throwing StackOverflowException on one of our auto-generated assemblies () is new. In this class (bear with me) please have 400+ simple properties which are in beginners (mostly default (string) etc.) in the manufacturer.

We saw that it is fine on 64 bit, but it goes on 32 bits, bang!

We need to test that if it is appropriate for our use case then we will have to provide room to breathe in order to make a big default stack, while we add the code generator again. .

We will be interested in solutions involving app.config if possible, but I am a realistic person, so anything will be good.

Due to the pile of flow again we have narrowed down the error to the creator in question. My first impression was also the type of infinite memories. However, we have reproduced the error using a 3-line console app that:

  • creates an empty charge of the class.
  • Calls a non-static method (clone) on the class, which is to prepare the first job and empty image is ready, pass these properties

It gets banged because it kills the other creator.

Now debugging through the .NET source code we see that the stack overflow Guid.NewGuid () which has passed the constructor as the second parameter. The actual line of code is the call to the local CoCreateGuid () call.

While it may be a bug in CoCreateGuid (), we want to eliminate our code with the problem. My first idea is to increase the size of the massive pile and see this error reoccurs. Then, since I think that we can control all the usage cases, the object replaces the initialization for the producer - it seems that it can overcome the pressure on the stack.

We can prevent the error by removing just from the class on the int properties.

You can change the stack size for the executable. You can not do this in app.config, as far as I know.

Another option (also mentioned on that page) is to create a new thread with the "correct" stack size. The page mentions the pros and cons of this approach.

I would wonder if setting up 400 properties in just one manufacturer was the cause of the problem ... that a large stack frame - but as long as you have on the stack Do not get large stack frames, so I hope it will be fine. The other possibility is that you've got endless recycling anywhere :)

EDIT: An alternative suggestion ...

You probably have many local variables in this manufacturer ? (Otherwise it should not take any more stack than any other call.) Is it possible to split the constructor into several methods, set 20 ways per method (say)? If the fields are read only, then it will be difficult.

If you can give us an idea that looks like a constructor, it will help a lot. You can also see that using ildasm to see what the size of the stack will be for that manufacturer.

Just to check it, it's a class instead of a structure, okay?


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -