On 9/19/06, Carlos <[EMAIL PROTECTED]> wrote:
typedef struct
{
  char catalogno[APP_MAX_ROW][32];
  int number[APP_MAX_ROW];
  int aid[APP_MAX_ROW];
  char title[APP_MAX_ROW][152];
} rQueryType;

 Originally I had AAP_MAX_ROW with a value of 100

now - lets check the size of this structure

 100 * 32 * 1
 100 * 4
 100 * 4
 100 * 152 * 1

= 19200 bytes

if you do within a function:

rQueryType query;

your going to HAVE TO have at least 19200 bytes available on the stack.
its a known fact that palmos only has a 4k stack - so, guess you are blowing
the stack :) - unless you are truely defining it as a true global variable.

 One thing though, and this is where my mistake might be, but I am
not sure I understand the Memory Manager all that well.  I am defining
the global variable as:

 rQueryType   rquery;

 As opposed to having something like:

 rQueryType*  rqueryPtr

 MemHandle h;
 h = MemHandleNew(SizeOf(rQueryType));
 rqueryPtr = MemHandleLock(h);
 // ... do whatever
 MemHandleUnlock(h);

the second way uses only 4 bytes on the stack. does it work better?

Reading up a little bit it says that using a Memory Handl helps resolve
issues with word alignment, although I am not sure this would be the
case for strcutures as well.

a structure is effectively a buffer of bytes. period. think like a CPU.

--
// Aaron Ardiri

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

Reply via email to