Click to See Complete Forum and Search --> : Calculate stack memory required for a c++ function


manju_hosur
November 19th, 2001, 10:40 PM
Hi,
I want to know how much stack memory is required for executing a normal c++ function under windows NT. Is there any function or win32 api which can be used to find the total amount of stack memory required by c++ class(function).

thanks and regards,
manju

James Curran
November 20th, 2001, 01:17 AM
Not for a particular class/function. There may be one to say how much your program is using total at that point in time. But the whole purpose of a stack is that total memory space used by it varies as the program runs. You'd have to measure it at various points, and record the largest.

And why are you concerned? Memory under Win32 is virtual. THe stack will expand as it is needed. If you are running out, it most likely indicates a bug in your program that's just sucking up all available memory.

Truth,
James
http://www.NJTheater.com
http://www.NovelTheory.com
I don't do it for the points (OK, maybe I do), but rating a post is a good way for me to know if I helped.