"Hello World" = 3MB of memory & 6-8 seconds to load

yairlanz

New Member
Don't get me wrong – B4PPC is a great tool to build apps for mobile device – it's simple, easy to use, fully documented, with numerous options and addons.

BUT

Running a very simple app like "Hello World" that weight only 40 KB (see code bellow) takes 6-8 seconds and about 3 MB of memory on the device.
A more complicate app will take about 10 seconds to load and 4-6 MB of memory.
I mean B4PPC is a very powerful tool but is there any way to reduce both memory and loading time?

"Hello World" Code:
Sub App_Start
Form1.Show
AddTextBox ("Form1","TextBox1", 60, 120, 100, 25, "")
TextBox1.text="Hello World"
End Sub
 

token

Member
Licensed User
My little notetrainer (52k EXE) takes also about 3mb of memory and loads pretty slowly.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
When you first run your application, the .Net CF is loaded.
Next launches should be faster.

.Net applications handle memory allocations using "garbage collection".
The garbage collector doesn't "hurry" to release allocated memory.
Generally speaking, when more memory is required by your application or other applications it will free unused memory.
It is very rare to get an "out of memory" exception.
 

token

Member
Licensed User
When you first run your application, the .Net CF is loaded.
Next launches should be faster.

.Net applications handle memory allocations using "garbage collection".
The garbage collector doesn't "hurry" to release allocated memory.
Generally speaking, when more memory is required by your application or other applications it will free unused memory.
It is very rare to get an "out of memory" exception.

Yes, your are right. After starting it the second, it loaded much faster. Memory manager showed even 4 mb more space after closing the notetrainer, but this reflects not the real usage of the program if I understood you right.
 

yairlanz

New Member
I'm not an expert but logically it just doesn't make sense, one form with one control (like "Hello World") weights 3 MB of memory. There must be a way to dispose most of the .netCF components.
I'm speaking theoretically – I don't really know what's going in there, but logically – don't you think that something here is wrong?
 

agraham

Expert
Licensed User
Longtime User
don't you think that something here is wrong?
No! That's the way .NET works. Why do you think it matters, have you run out of memory? How the Compact Framework manages memory is invisible to you and is meant to be invisible. One of the main advantages of .NET is that memory is managed for you - no reference counting, no remembering to free malloced blocks of memory, no memory leaks.

Relax, buy Basic4ppc, get on with coding and let the Framework look after itself.
 

yairlanz

New Member
much faster

That was much faster. It didn't take less then 1 second (close to 3 seconds) but it only required 0.6 MB of memory.
I guess my version is obsolete. (both WM5 & B4PPC)
 
Top