Announcement

Collapse
No announcement yet.

Funny but how a 8K can come into a 1116K???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Funny but how a 8K can come into a 1116K???

    Hello every one!

    That made a long time that I wrote on it forum!
    I let a little bit Power Basic on the site...

    But, last time, I made a small software (yes
    I nerver stop) who change the system date on
    the fly (10K).

    I was in the task manager of Windows 2000 when
    my attention was drawed to something... In the
    memory usage of the list of task, my small 10K
    took 1016K??!!

    Same the tiny HelloWord took 1116K???!!

    Why?? Is the Power Basic exe load all the Win
    API DLL for running? What'a appening exactly?

    I can sleep tonight if I could'nt gat an answer
    but it still a mistery to clear up!

    Have a nice day although!




    ------------------
    -------------------------------------------
    Francis Beaulieu
    FrabLaser Softwares
    Francis Beaulieu
    Prog senior of 17 years.
    Microsoft Specialist

  • #2
    PowerBASIC allocates an initial stack frame of 1Mb. The remainder is app and data memory usage.

    Remember, the disk file size bears no direct relationship to the amount of memory or resources an application may need. A better clue is given in the compiler results in the "memory image" statistic - this is the amount of memory occpied by the actual executable code when the app is loaded. The difference between the figure you qote and the memory image size will comprise the actual memory consumption by the running code.

    In addition, this figure can change dynamically as Windows manages memory. This has been discussed on the BBS before (search for "workingsize" or "workingset" - off hand I don't recall the exact topic title)

    In summary, this is quite normal and certainly nothing to worry about.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Lance,

      What you say is true, but Win2000 goes beyond that. It's also
      allocates some additional memory. You see this by opening the
      Task Manager, place it to one side. Run your program.

      While watching the Task Manager, minimize your program. My program
      dropped to 170k. Restore the program, my 170k program grows to
      about 2.5MB!

      Although my program uses EZGUI and Cheetah Database, I can see
      why it's allocated this amount. What's strange is that when it's
      minimized in Win2k, it drops to 170kb (like a memory release).

      Couldn't find anything on MS site pertain to this issue.

      Thanks
      MWM



      ------------------
      mwm
      mwm

      Comment


      • #4
        I would not describe it as an "issue", but rather as a question on how Windows manages memory allocated to applications. I cannot see MS being too keen on disclosing all of their VMM techniques.

        As I noted, Windows appears to dynamically free or allocate resources (memory, stack, etc) to applications. For example, when an app minimizes, no window redrawing will take place so I would assume that Windows frees some resources for the duration. While there is an API that can be used to minimize the amount of memory allocated to an app (SetProcessWorkingSet or something like that), but I don't see any "real" need to bother other than for "aesthetic" purposes.

        Anyway, it is good to see you all take a keen interest in all aspects of the war on bloatware.

        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          What Lance has mentioned translates out into 2 settings in a PE
          file header, "Stack Reserve" and "Stack Commit", in laymens terms
          the difference between what it will take if it can get it and what
          a program needs.

          Although most people who understand it have reservations about the
          techniques that Microsoft use as memory management, the PE standard
          currently runs across the range of 32 bit windows operating systems
          and will probably continue to do so until Microsoft change the rules
          so that they can sell more copies of a new version of windows.

          Regards,

          [email protected]

          ------------------
          hutch at movsd dot com
          The MASM Forum

          www.masm32.com

          Comment


          • #6
            I mentioned something about this when PB/CC first came out. Never did get a reply.

            Below is an excerpt from the PowerBasic website page http://www.powerbasic.com/products/pbcc/

            "You know, a typical shopping cart program written in Visual Basic needs some 5 Megabytes of RAM. So, using VB, you may find you're limited to around 20 simultaneous connections. But use PB/CC instead, and memory needs plummet! To around 100K total! That means 1000 simultaneous connections on that very same Web Server!"

            This statement does lead you to believe the memory usage is going to be around 100k not 1Mb.
            David Martin
            www.ivyleague.net
            Home of Ivy Route, software for newspaper dealerships, distributors and agents.

            Comment


            • #7
              The key point to remember is that process memory consumption is totally "dynamic" and managed by Windows on your behalf...

              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment


              • #8
                It's important to keep in mind the difference between the amount of memory that is "currently allocated" for an application, and the amount that is "dedicated" to it.

                As I understand it, the number that is being discussed -- the Mem Usage number that is displayed by the NT Task Manager -- is basically "the amount of memory that is available to an application without it having to ask for more".

                When Windows starts an app it gives it lots of room to play. The app may or may not use all of the memory that is allocated to it. In fact it may request more if it needs to. And if another application needs memory, Windows can reduce the amount that is allocated to other applications.

                If your app doesn't use the meg (or whatever) that is allocated to it, it's no big deal. Windows will give that memory to any app that needs it. If your app needs more, it can have it.

                There are ways to artificially reduce the number that is displayed by Task Manager -- search this BBS for SetProcessWorkingSetSize -- but all that does is make you feel better. It actually hurts the performance of memory-intensive apps.

                VB apps are "physically" much larger than comparable PB apps, and the huge VB runtime libary has to be loaded into memory whenever a VB program is run. That's memory that is dedicated to the application, so it is not available to other apps unless disk-memory swapping takes place.

                So Yes, a PB program requires much, much less memory than a comparable VB app. The numbers that are shown by Task Manager are a gross over-simplification of "Mem Usage".

                -- Eric


                ------------------
                Perfect Sync Development Tools
                Perfect Sync Web Site
                Contact Us: mailto:[email protected]fectsync.com[email protected]</A>



                [This message has been edited by Eric Pearson (edited June 06, 2001).]
                "Not my circus, not my monkeys."

                Comment


                • #9
                  Thanks to every one!

                  I will be capable to sleep tonight!!

                  Lance your explanation was correct, but...
                  ratatatammmm... the one of Eric was very
                  very good! I took his word for it!

                  Then still have a nice day and take care
                  (of Vb huge memory spending)!!!

                  Bye!



                  ------------------
                  -------------------------------------------
                  Francis Beaulieu
                  FrabLaser Softwares
                  Francis Beaulieu
                  Prog senior of 17 years.
                  Microsoft Specialist

                  Comment

                  Working...
                  X