FYI, Poser keeps track of the low-water mark for each stack that it 
identifies.  There's currently no way to extract that information 
(that is, there's no UI to report it and it's not logged anywhere 
when the application quits), but you could add that if you wanted. 
In the function SysHeadpatch::SysAppExit, look for where 
CheckForMemoryLeaks() is called.  At that same location, you could 
report the information found in Poser's global variables gStackHigh, 
gStackLowWaterMark, gStackLowWarn, and gStackLow.  You might also 
want to augment that reporting by taking a snapshot of the functions 
on the stack at the time that low-water mark was reached, so that you 
know what lead to that condition.  I can point you to the appropriate 
routines to gather and print that information if you want.

-- Keith Rollin
-- Palm OS Emulator engineer


At 4:08 PM +0000 3/18/02, Russell K Bulmer wrote:
>I'm currently trying to get some stats on my application's memory usage,
>including the amount of stack being used.  Using SysGetStackInfo() I can get
>the start and end of the stack, but to work out how much is currently being
>used I need access to the stack pointer.
>
>So, does anyone know of a way in C/C++ to get the stack pointer?
>
>Failing that, it'll have to be assembler, right?  Unfortunately I don't know
>assembler.  I'm pretty sure it would only be a few lines of asm to get the
>stack pointer and store it in a variable for use in C/C++ code after it -
>would anyone be kind enough to jot down the asm I'd need to do this?

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to