That would be the quick answer, yes.  But, to my mind, it would be 
the wrong one.  Probably the reason why you need so much memory for 
your globals would be because you have a few large ones (arrays, 
perhaps), rather than many, many small ones.

So the second answer would be to look for any large arrays and figure 
out what to do with them.  The quick answer there would be to change 
something like:

        char my_global_array[10000];

into something like:

        char* my_global_array;

That would change a 10K variable into a 4 byte variable.  You would 
then dynamically allocate the 10K buffer using MemPtrNew.  But, 
whoops, you can't do that either!  That 10K allocated by MemPtrNew is 
coming from the same heap that they system uses to allocate your 
globals.  If the system failed trying to do that, then your call to 
MemPtrNew may fail, too.

Possibly you have some excess that you can excise anyway.  For 
instance, maybe you have something like:

        char my_global_name_array[256][100];

This would be a 100-element array of strings each 256 bytes long. 
Someone might use this to keep track of a list of names or whatever. 
But it's 25K long and there's a lot of waste there.  A second version 
might look like:

        char* my_global_name_array[100];

This is a 100-element array of string pointers.  The array is 400 
bytes long, and that's all it takes as long as it's empty.  Whenever 
you want to add an entry, you can allocate just the space you need 
with MemPtrNew (not necessarily a full 256 bytes) and store the 
resulting pointer in the array.

Anyway, those are all suggestions based on possibly reasons why 
you're out of global space.  If you're actual situation doesn't fit 
anything here, post it here and perhaps we can all get creative for 
you.

-- Keith


At 10:35 PM -0400 6/27/01, Paul Tomsic wrote:
>so clearly the quick answer is to not have so many global variables, right?
>
>"Keith Rollin" <[EMAIL PROTECTED]> wrote in message
>news:54653@palm-dev-forum...
>>
>>  Short answer: it means that there's not enough space in the dynamic
>>  heap to contain all your global variables (which get stored there).
>>
>>  Longer answer: Search your hard disk for PalmOS_Startup.c.  Open it.
>>  Look at line 96.  You'll see that it's reporting an error from
>>  SysAppStartup.  Even though you can get the Palm OS source code, I'm
>>  not sure if it contains SysAppStartup.  So I'll tell you here that
>>  the only error it returns is if it can't allocate the buffer for your
>>  global variables.
>>
>>  -- Keith
>>
>>
>>  At 10:01 PM -0400 6/27/01, Paul Tomsic wrote:
>>  >Hi,
>>  >
>>  >When I start debugging my program, the POSE starts, and gives the
>following
>>  >error:
>>  >
>>  >"UIAppShell" (unknown version) reports "PalmOS_Startup.c, Line:96, Error
>>  >launching application"
>>  >
>>  >what is this, and how do I get it to stop?
>>  >
>>  >
>>  >thanks
>>  >
>  > >Paul

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

Reply via email to