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

折月煮酒 提交于 2019-11-28 12:37:13

You can use editbin to change the stack size for the executable. You can't do this in app.config as far as I'm aware.

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

I'd be surprised if just setting 400 properties in a constructor was the cause of the problem though... that's going to be one big stack frame - but unless you've got several big stack frames on the stack, I would expect it to be okay. The other possibility is that you've got endless recursion somewhere :)

EDIT: An alternative suggestion...

Presumably you have a lot of local variables in this constructor? (Otherwise it shouldn't take up any more stack than any other call.) Is it possible to split the constructor into multiple methods, setting (say) 20 fields per method? That will be tricky if the fields are read-only, admittedly.

If you could give us an idea of what the constructor looks like, that would help a lot. You might also want to use ildasm to see what it claims the stack size will be for that constructor.

Just to check, this is a class rather than a struct, right?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!