The .NET stack vs Windows stack

前端 未结 2 1160
名媛妹妹
名媛妹妹 2020-12-06 18:19

The Windows Internal book 5th edition has the following comment in page 360.

The stack size for the initial thread is taken from the image—there’s no way 
to spec         


        
2条回答
  •  猫巷女王i
    2020-12-06 18:59

    Here's a similar discussion on the topic.

    Question

    The documentation indicates that the threads "default stack size" is 1MB. The work "default" implies that it can be changed.

    Is it possible to change the StackSize in .NET? If so how?

    Answer

    Unfortunately no. The documentation you were reading was for the creation of new threads in the system, which is handled by the Thread class. The CreateThread API function allows you to set the stack size and you can call it from .NET. However, I don't know if that is a good idea, since I am not sure how the runtime will perceive that thread.

    Here is a code sample for creating threads using the CreateThread API

    http://www.codeproject.com/KB/threads/Threads_1.aspx

提交回复
热议问题