Subject: Re: stack overflow error
From: [EMAIL PROTECTED]
Date: Tue, 24 Aug 2004 14:02:20 -0400

Thanks Jan, you have been a great help..how do I set the stack pragma to compile these critical functions?

...I found a way to somewhat resolve the problem. I have 3 fairly large structs (about 60 variables). When I try to store all the data in one form, thats when it gives me the stack overflow error. So I created another save form and stored data to 2 of the large structs there, and it didnt give me the error. However, it's still giving me a warning saying that I am 'close' to overflowing the stack, but the program is still running fine on the palm device....I would still like to know how to check for functions that are overflowing the stack however for my own knowledge. I've never really tried to debug in a low source level.

What is the stack impact of these struct's ??

Are you doing:
        struct FIELD_DEF {...} fields;      /// wrong!!! , uses stack
or
        struct FIELD_DEF (...) *pfields = NULL;     // stack impact is 4 bytes
        pfields = (struct FIELD_DEF *)
                MemPtrNew (sizeof (struct FIELD_DEF) + 2);
        if (pfields == NULL) {  /* handle memory error */ return -1;}
        MemSet ((MemPtr)pfields, sizeof (struct FIELD_DEF) + 2, 0);
                // Note defensive programming techniques
        ...
        ...
        ...
        MemPtrFree ((MemPtr)pfields; pfields = NULL;
        return 1;


Roger Stringer Marietta Systems, Inc. (www.rf-tp.com)


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

Reply via email to