Determining the stack size at run-time

  • Follow


hi all.
i suspect that we have some kind of stack overflow in 'release', and i
would like to add protection code.
i am looking for a function that can tell me the current thread stack
size. i am sure there is one out there, but i could not find it (till
now)
anyone ?

thanks

Noam
0
Reply noam 7/7/2009 6:51:32 AM

No function will tell you how.  You can take address of stack variable and 
call VirtualQuery using that address.  From that you can determine the stack 
base address and stack size (reserve + commit)

You have to call VirtualQuery one more time with stack base address if you 
want to determine how much is committed. stack size (determined by first 
call) - mbi.RegionSize of second call.
-- 
Michael Salamone
Entrek Software, Inc.
www.entrek.com


"noam" <ngraetz@gmail.com> wrote in message 
news:f79cb4d2-89b6-4248-91ed-4b472323527f@o6g2000yqj.googlegroups.com...
> hi all.
> i suspect that we have some kind of stack overflow in 'release', and i
> would like to add protection code.
> i am looking for a function that can tell me the current thread stack
> size. i am sure there is one out there, but i could not find it (till
> now)
> anyone ?
>
> thanks
>
> Noam 

0
Reply Michael 7/9/2009 5:35:15 AM


1 Replies
429 Views

(page loaded in 0.039 seconds)

Similiar Articles:













7/23/2012 6:22:16 AM


Reply: