Maybe to specify it: Don't use array declarations in your functions, use
dynamic allocated memory with MemPtrNew() etc. This will save a lot of
space. Another thing could be to use static variables, they are
allocated in the global space, not on the stack.
Regards
Henk
Keith Rollin wrote:
Thomas,
As Logan mentioned, running your application under the Palm OS Emulator
will tell you when your application overflows the stack and (if
possible) even when it's close to overflowing the stack. When you get
such a message from the Emulator, it will include a partial stack trace,
showing what functions are on the call stack and how much of the stack
they are using.
It's my guess that one or two of those functions are taking up an
inordinately large amount of stack space, and that reworking those one
or two functions to dynamically allocate space from the heap instead of
the stack will solve your problem. After all, with a 4K stack, if the
average amount of stack space each function took was 40 bytes, you could
stack up 100 function calls, which is not very likely the case. It's
much more likely that one or two functions is taking 1K or more space on
their own.
If you are using CodeWarrior, you can use #pragma warn_stack_usage in
your source code to generate a list of functions that are using large
amounts of stack.
-- Keith
On Dec 20, 2004, at 12:34 AM, Thomas Damme wrote:
thanks for all the responses. To clarify, whats the problem: I dont
use any
recursion. Personally I dont like that.
What I/we have is some kind of a framework that abstracts many of the
palm-specific formhandling and -design. The application requires some
"levels" in the callstack, the framework itself too and the framework
calls
a Table-function which also calls many sub-functions. And in one of these
calls, it overflows the stack.
So I have to increase the stack/function stack (if there is something
like
that) or I will have to rewrite my application and the framework in
order to
have as few functions as possible. But this could result in a bad design
since I'm proud to have a good one right now ;-)
--
-------------------------------------------------------------------------
Henk Jonas
Palm OS � certified developer
[EMAIL PROTECTED] www.metaviewsoft.de
-------------------------------------------------------------------------
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/