windows stack

Hello
How/where can I find out the size of stack. Is there any posibility to find out size of stack and heap for one process in c++.
Thank you
I'm sure there is, but on NT-based systems (like XP and Vista) the stack is dynamically handled by the OS -- meaning that it grows as necessary.
Some idea how to get the size of stack in c++. I don't know where to start.
closed account (z05DSL3A)
According to the MSDN docs on the /F Compiler Option[1]
Without this option the stack size defaults to 1 MB.


I remember reading somthing a while ago about calculating the size of the remaining stack space by using the stack pointer and a pointer to the base of the stack. However this used an undocumented feature of the Windows API and I'm having trouble tracking it down.

edit:
All I have found is:
Look at the difference between the current stack pointer and
(PNT_TIB)NtCurrentTeb()->StackLimit.

it may help you on your way to tracking down a 'better' answer.


[1] http://msdn.microsoft.com/en-us/library/tdkhxaks(VS.80).aspx
Last edited on
Also, the C/C++ stack grows dynamically on WIN32.
Topic archived. No new replies allowed.