>From page 183 of Palm OS Programming: the Developer's Guide (used with
permission):
UInt32 GetStackSpaceUsed()
{
MemPtr bottomOfStack;
MemPtr topOfStack;
Uint16 aStackBasedVariable;
SysGetStackInfo(&topOfStack, &bottomOfStack);
return (UInt32)
Abs((char *) &aStackBasedVariable - (char *) bottomOfStack);
}
Neil
>From page on 3/18/02 8:08 AM, Russell K Bulmer at [EMAIL PROTECTED]
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?
>
>
> Thanks in advance,
> Russell
>
>
>
--
Neil Rhodes
[EMAIL PROTECTED] Available for contract programming
Coauthor: Palm OS Programming: the Developer's Guide, 2nd edition (O'Reilly)
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/