>Subject: Re: CodeWarrior and variables
>From: "Ben Combee" <[EMAIL PROTECTED]>
>Date: Fri, 10 Nov 2000 23:36:01 -0600
>"Michal Seliga" <[EMAIL PROTECTED]> wrote in message
>news:29654@palm-dev-forum...
>
> Hello
>
> Our project in C++ is quite large and now we run out of global
> variables space. Codewarrior shows, that we use 45kB of data
>and MAP file generated by linker
> shows that we use 32kB of data section below A5 and 18698
> bytes above A5.
>
> We wanted to know where we take so much space, because
>most of all ours global variables are shorts, ints, or pointers.
> I took all global variables from one
> file (CodeWarrior shows 8805 bytes of data), put them into one
>structure and made sizeof(struct ..). The result was 1096bytes.
1) Global variables are EVIL, but frequently a necessary evil.
Analyze your code and see if you can eliminate most of them.
2) I notice you said that some of your global variables are pointers.
I presume you are allocating memory space to these pointers
at runtime. This is probably the root of your problem.
You may solve your problems if you only allocate space
when you need it, and promptly release it when finished.
Thus arrange your application not to need too much heap
memory at any one point in time.
Otherwise you may be advised to put some of the memory
space into a database. Remember Palm OS (r) databases are
just persisent clumps of memory.
Roger Stringer
Marietta Systems, Inc.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/