Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view the current stack size of a windows thread when it overflows

I have a process that is overflowing the stack when run from within an IIS process, but works fine when run on its own. I suspect that on its own it gets the default 1MB stack, but within IIS gets somewhat less.

To avoid messing with the IIS worker processes I am using a sub-thread within the IIS process to allocate a bigger stack, but I suspect the stack size argument to Thread creation is being ignored as per the documentation (http://msdn.microsoft.com/en-us/library/ms149581.aspx)

When the stack overflows I can view the halted process in the debugger, but how do I find out how big a stack was actually allocated?

like image 523
Matt T Avatar asked Oct 19 '25 15:10

Matt T


1 Answers

The answer is as follows.

In debugger, add a watch on the pseudo register TIB (http://msdn.microsoft.com/en-us/library/aa232399(v=vs.60).aspx )

Now take this value and display that address in a memory window. Subtract the third 4 byte word from the second 4 byte word, remembering to use little endian byte ordering. http://en.wikipedia.org/wiki/Win32_Thread_Information_Block

like image 70
Matt T Avatar answered Oct 21 '25 03:10

Matt T



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!