Performance vs Memory

RandomCoder

Well-Known Member
Licensed User
Longtime User
I'm well under way with my SMS application now, but as I add more functions it dawned on me that maybe my approach is wrong.

Basically I'm using one Form and several panels.
All is working well so far, but at present I just set the visibility of the controls as required (Erels runtime example has been a tremendous help... http://www.b4x.com/forum/showthread.php?t=907).

So far the application is fast and works exactly as I intended.
But, and here is the question, should I really be disposing the controls instead of hiding them?

I ask this because the application will be running in the background the whole time my Device is switched on and so I want it to hog as little of the resources as possible.
Maybe I'm misgiven in my assumption that more controls (even if hidden) means more memory, and I'd be grateful of some advice on this matter.

Regards,
RandomCoder
 

agraham

Expert
Licensed User
Longtime User
Maybe I'm misgiven in my assumption that more controls (even if hidden) means more memory, and I'd be grateful of some advice on this matter.
You are not mistaken, instantiated controls will take extra memory even when hidden. However if you are only talking about a few (say ten or fewer) it probably doesn't matter much in the great scheme of things. If you are talking about a lot (many tens) it will be a trade off of memory saving by disposing them against the time taken to rebuild them when needed. Look and see (Settings->System->Memory Program memory in use) how much memory your app uses when it is started and make up your mind then.
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Thanks Agraham, I wish I had your indepth knowledge of these things.
Unfortunately your repy is exactly as I already expected.
Can I ask, have you any formal qualifications in programming? I've a little knowledge of C and VHL and work with Ladder Logic (if you can call that a language :)). Just wondering if there is any hope for me ;)
Maybe I've had a few too many beers tonight!

Thanks,
RandomCoder
 

agraham

Expert
Licensed User
Longtime User
Can I ask, have you any formal qualifications in programming?
Not really but I have been in computers all my life. I saw my first one when I was about eleven, an early Ferranti with valves and mercury delay lines and was instantly hooked. I graduated in 1968 with a BSc in Electronic Engineering, as there were no computer specific cources in those days, and joined Ferranti. Ever since then I have been involved in hardware, software and overall computer System Design. I guess I'm lucky, logic seems to be the one thing I can honestly say that I'm any good. Other peoples' brains seem to be wired for music or art or literature - mine seems to be wired for computer sytems design.
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
.... Other peoples' brains seem to be wired for music or art or literature - mine seems to be wired for computer sytems design.

Nice one.

I've a degree in engineering, but these days they try to cover too much in the courses and so I've only touched on C and VHL, the rest I have picked up myself through trial and error.

I always consider programming to be like handwriting... everyone has their own style and way of writing - it's just that some people's is more elegant than others.

Regards,
RandomCoder
 
Top