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

Discussion in 'Questions (Windows Mobile)' started by yairlanz, Jul 26, 2008.

  1. yairlanz

    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.


    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
    AddTextBox ("Form1","TextBox1", 60, 120, 100, 25, "")
    TextBox1.text="Hello World"
    End Sub
  2. Erel

    Erel Administrator Staff Member Licensed User

    Which version are you using and on what device?
    Optimized compiled applications should load pretty quickly.

    For some reason you appear as an unlicensed user.
    Please send me a private message with the email address you have used when buying Basic4ppc so I will fix this issue.
  3. token

    token Member Licensed User

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

    Erel Administrator Staff 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.
  5. token

    token Member Licensed User

    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.
  6. yairlanz

    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?
  7. agraham

    agraham Expert Licensed User

    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.
  8. Erel

    Erel Administrator Staff Member Licensed User

    You can test the attached Hello World example which was compiled with version 6.30.
    It loads in less than one second.

    Note that it requires .Net CF 2.0.

    Attached Files:

    • 1.zip
      File size:
      12.4 KB
  9. yairlanz

    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)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice