SysGetStackInfo() reports the space allocated for use as a stack. The value of the stack pointer (SP or a7) tells you where you are in the stack.
I believe SysGetStackInfo() returns the address of the first and last bytes allocated to the stack, so actual stack size would be (end - start + 1). You can read the stack pointer with the following: UInt32 GetSP(void) = 0x200F; To determine how much of the stack has been consumed; ((UInt32)end - GetSP() + 1) bytes. To determine how much of the stack remains; (GetSP() - (UInt32)start) bytes. -------------------- Jeff Loucks Mobile 253-691-8812 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim McGowen Sent: Tuesday, January 31, 2006 3:24 PM To: Palm Developer Forum Subject: Stack Size I got this from another post: >Chris Apers previously wrote: >> Is there a way to know the size of the stack ?. > >UInt32 GetStackSize( // returns size of stack in bytes > void) // no parameters > > { > MemPtr StartPP = NULL; > MemPtr EndPP = NULL; > > SysGetStackInfo(&StartPP, &EndPP); > > UInt32 TotalBytes = (Char *) EndPP - (Char *) StartPP; > return TotalBytes; > } > >Given StartPP and EndPP you can also determine the amount of stack used and >amount unused. My question is, how do you use StartPP and EndPP to determine the amount of stack used and amount unused? SysGetStackInfo always gives me the same values no matter where in my app I call it. - Jim -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
