Monitoring call stack size in Visual Studio

前端 未结 3 1339
栀梦
栀梦 2021-01-13 07:17

Is there a way to monitor the call stack size in Visual Studio ? A call stack window is provided while running but does not show the size of the stack. I am using C++ and fa

3条回答
  •  难免孤独
    2021-01-13 07:54

    There are a few ways:

    1. Examine ESP in the watch window. You can do this by watching @esp in the watch window. Compare this to what ESP was at the start of the process.
    2. Similarly, examine the address of stack-allocated variables in first / last stack frames.

    Note that the stack is usually allocated backwards, so as the stack grows, ESP gets smaller and smaller.

提交回复
热议问题