Pelles C forum

C language => Pocket PC and Smartphone questions => Topic started by: grom-it on September 26, 2007, 01:12:54 AM

Title: Memory Saving Tips Required
Post by: grom-it on September 26, 2007, 01:12:54 AM
I am currently writing a small pocket pc application that is to do with my line of work

As i have poor eyesight i have written it using window and controls created at run time that allow me to use larger text

i have 18 buttons (12 of which form a numerical keypad), 2 edit boxes and a combo box control
all of which are hidden and shown as required.

I have also read somewhere that on a pocket pc
! Globals are better than locals !
I find that very unconventional.

My question is that whilst my app is working ok
it would be nice if i had a better understanding of how i might save some memory should the need arise.
Any links or advice would be appreciated.
BTIA
Title: Re: Memory Saving Tips Required
Post by: grom-it on September 27, 2007, 02:50:48 PM
I think i should Rephrase this question

What i am asking is
Can I ? and should I ?
Be destroying and recreating windows on the fly to save memory
Title: Re: Memory Saving Tips Required
Post by: JohnF on September 27, 2007, 06:57:25 PM
I think i should Rephrase this question

What i am asking is
Can I ? and should I ?
Be destroying and recreating windows on the fly to save memory

My opinion is no, once you have created a window best to leave it until your app closes.

I also find "Globals are better than locals" strange. Maybe the Pocket PC has a small stack but provided your local vars are not huge it shouldn't be a problem.

John
Title: Re: Memory Saving Tips Required
Post by: audiofish on September 28, 2007, 10:22:23 PM
I can't see using globals everywhere a benefit; in fact I'd say it uses more memory - you'd have unused variables hanging around which aren't storing anything useful between function calls, leaving it unavailable for other uses.