On Sun, 27 Feb 2000 20:33:20, Sally-Anne Palmer writes:
>I'm getting a stack overflow error in my app and was wondering if anyone can
>point me in the right direction for some information on the stack and how I
>can monitor it.
Stack overflow can indicate allocating too many local variables, or
using too deep subroutine nesting or recursion. PalmOS versions prior
to 3.0 allow less than 2k in total live local variables before you
overwrite memory outside of the application stack (given the existing
C compilers and/or the lack of an MMU).
One can view the subroutine nesting at any breakpoint when using the
Codewarrior debugger; and you can use "Show Memory" on any local
variable to see it's memory address. The difference between the
highest addressed local variable in PilotMain and the lowest addressed
local variable in your deepest nested subrouting is a rough
approximation to the stack usage. Or one can use a System OS call to
get the application stack chunk base and size, and stow that away in
some global variables for comparison at runtime.
IMHO. YMMV.
Ron Nicholson
HotPaw
http://www.hotpaw.com/rhn/hotpaw/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html