--- Venugopal B wrote:
> I added a member variable(UInt16) to one of the structs
> ...
> "The application has just overflowed the stack."
>
> If I comment out the new member variable that I added
> then things seem to work fine.
So, it seems obvious that you are declaring a stack based variable of
that structure type, and that is too big for the stack. The stack on
Palm OS devices is really small. (It's documented somewhere, but I
forget where.)
The simple solution is: don't put so many variables on the stack.
Alternatives:
1. Use a global variable.
2. Allocate space for the variable dynamically.
3. Use streams, databases, etc.
Here is an example of method 2:
typedef struct
{
Char bigString[512];
UInt16 something;
} MyType;
static void MyFunction(void)
{
MyType mt; // stack overflow!!!
// etc.
}
This is probably too big to go on the stack, even without the UInt16.
What to do?
static void MyFunction(void)
{
MyType *mtP; // declare a pointer
// now, allocate space for it on the heap
mtP = (MyType)MemPtrNew(sizeof(MyType));
// etc.
// free up the space when done
MemPtrFree(mtP);
}
See also: MemHandleNew, MemHandleLock, MemHandleUnlock, MemHandleFree
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/