Memory Saving Tips Required

Started by grom-it, September 26, 2007, 01:12:54 AM

Previous topic - Next topic

grom-it

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

grom-it

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

JohnF

Quote from: 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

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

audiofish

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.