Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Memory...

Memory...

Scheduled Pinned Locked Moved Visual Basic
csharpwinformsgraphicsperformance
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tim McCurdy
    wrote on last edited by
    #1

    I don't know if this affects C#, but it was pointed out to me that a .NET application uses huge amounts of memory. I was wondering if anyone could shed some light on this or send me some links on Memory Management? For example, create a new VB.NET Windows Forms project. Do NOT add any code to the Form. Run the program and look in the task manager under your Program Name. You'll notice probably about 8,000 - 12,000 kb of memory being used. Now, Minimize the Form and the Memory drops to 600 - 650kb!!! :omg: Restore the Form and now it only uses 1500 - 2000 Kb of Memory! What in the world is going on!? :wtf: Has anyone else noticed this? I have a feeling it has something to do with GDI and Painting but I am not sure.

    D 1 Reply Last reply
    0
    • T Tim McCurdy

      I don't know if this affects C#, but it was pointed out to me that a .NET application uses huge amounts of memory. I was wondering if anyone could shed some light on this or send me some links on Memory Management? For example, create a new VB.NET Windows Forms project. Do NOT add any code to the Form. Run the program and look in the task manager under your Program Name. You'll notice probably about 8,000 - 12,000 kb of memory being used. Now, Minimize the Form and the Memory drops to 600 - 650kb!!! :omg: Restore the Form and now it only uses 1500 - 2000 Kb of Memory! What in the world is going on!? :wtf: Has anyone else noticed this? I have a feeling it has something to do with GDI and Painting but I am not sure.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      It's nothing you have to worry about and just about everyone has noticed this. When your app is launched, you have the entire weight of the .NET Framework loaded behind it, taking up a bunch of RAM. When your app is minimized, a bunch of data and code is moved to the page file and out of RAM since it's not being used by a foreground process. When your app is maximized again, only the data and code that gets executed and referenced gets moved back into RAM and out of the page file. When the is being used and exercised, more data and code will get moved back into RAM while seldom used data and code gets moved back to the page file. It's that simple. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      H 1 Reply Last reply
      0
      • D Dave Kreskowiak

        It's nothing you have to worry about and just about everyone has noticed this. When your app is launched, you have the entire weight of the .NET Framework loaded behind it, taking up a bunch of RAM. When your app is minimized, a bunch of data and code is moved to the page file and out of RAM since it's not being used by a foreground process. When your app is maximized again, only the data and code that gets executed and referenced gets moved back into RAM and out of the page file. When the is being used and exercised, more data and code will get moved back into RAM while seldom used data and code gets moved back to the page file. It's that simple. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        H Offline
        H Offline
        halhamilton
        wrote on last edited by
        #3

        Rage - do you happen to know if, in a System Tray application, the memory remains allocated? Looking at the Task Mgr, it seems that my fairly simple app is sucking 12MB while the icon just sits there. Thanks! Hal in AZ

        D 1 Reply Last reply
        0
        • H halhamilton

          Rage - do you happen to know if, in a System Tray application, the memory remains allocated? Looking at the Task Mgr, it seems that my fairly simple app is sucking 12MB while the icon just sits there. Thanks! Hal in AZ

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Same thing. When the .NET Framework detects Windows getting low on memory, it'll start swapping things to the pagefile as needed. No! You're application will NOT hold onto 12MB of physical RAM while it's idling AND the system needs memory. If Windows can afford to let an application be a hog for awhile, it will. When memory starts to run low, the .NET Framework will start tightening its belt. Until then, there's no reason why your application and the Framework can't stay in memory. It helps with performnace if there is no page swapping going on. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          H 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Same thing. When the .NET Framework detects Windows getting low on memory, it'll start swapping things to the pagefile as needed. No! You're application will NOT hold onto 12MB of physical RAM while it's idling AND the system needs memory. If Windows can afford to let an application be a hog for awhile, it will. When memory starts to run low, the .NET Framework will start tightening its belt. Until then, there's no reason why your application and the Framework can't stay in memory. It helps with performnace if there is no page swapping going on. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            H Offline
            H Offline
            halhamilton
            wrote on last edited by
            #5

            Thanks Dave! That makes it less painful. Hal in AZ

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups