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 Problem [modified]

Memory Problem [modified]

Scheduled Pinned Locked Moved Visual Basic
performancehelpannouncement
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.
  • M Offline
    M Offline
    mtone
    wrote on last edited by
    #1

    I have a application that does not seem to release memory after opening and closing a new screen. A screen is just usercontrols loaded into a panels. There is a manager to handle this that is rather complex and since I did not write the application I am having a hard time figuring out where to look. In task manager my memory usage for the exe goes from 40 to 100 meg in no time almost 5 meg for every open screen but when they close it does not release the memory. Does anyone have or know of a tool or technic that I can use to track this down or how I can go about looking for the problem. Thanks Joe -- modified at 9:35 Friday 9th June, 2006

    G D 2 Replies Last reply
    0
    • M mtone

      I have a application that does not seem to release memory after opening and closing a new screen. A screen is just usercontrols loaded into a panels. There is a manager to handle this that is rather complex and since I did not write the application I am having a hard time figuring out where to look. In task manager my memory usage for the exe goes from 40 to 100 meg in no time almost 5 meg for every open screen but when they close it does not release the memory. Does anyone have or know of a tool or technic that I can use to track this down or how I can go about looking for the problem. Thanks Joe -- modified at 9:35 Friday 9th June, 2006

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      You can look for a profiler that will show you (among other things) what kind of classes it is that is allocated in the heap. When controls are used in a form, the form takes care of calling the Dispose method of the controls. If you add and remove controls yourself, you have to call the Dispose method yourself when removing them. --- b { font-weight: normal; }

      1 Reply Last reply
      0
      • M mtone

        I have a application that does not seem to release memory after opening and closing a new screen. A screen is just usercontrols loaded into a panels. There is a manager to handle this that is rather complex and since I did not write the application I am having a hard time figuring out where to look. In task manager my memory usage for the exe goes from 40 to 100 meg in no time almost 5 meg for every open screen but when they close it does not release the memory. Does anyone have or know of a tool or technic that I can use to track this down or how I can go about looking for the problem. Thanks Joe -- modified at 9:35 Friday 9th June, 2006

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

        Task Manager is the worst place you can look to see how much memory your app is using. What you're actually seeing is how much memory the virtual machine (.NET CLR) is both using and has reserved for your application. Even though it looks like your app is being a memory hog, it's not. The memory you see as being "used" is actually being reserved, held in the Managed Heap, for future allocations by your application. Use the Performance Monitor and the .NET Memory counters, or some other profiling tool, to see how much memory your app is actually using. Dave Kreskowiak Microsoft MVP - Visual Basic

        M 1 Reply Last reply
        0
        • D Dave Kreskowiak

          Task Manager is the worst place you can look to see how much memory your app is using. What you're actually seeing is how much memory the virtual machine (.NET CLR) is both using and has reserved for your application. Even though it looks like your app is being a memory hog, it's not. The memory you see as being "used" is actually being reserved, held in the Managed Heap, for future allocations by your application. Use the Performance Monitor and the .NET Memory counters, or some other profiling tool, to see how much memory your app is actually using. Dave Kreskowiak Microsoft MVP - Visual Basic

          M Offline
          M Offline
          mtone
          wrote on last edited by
          #4

          What is the affect on the system if that number continues to grow. Like you said it is reserved but doesn't that have the same kind of problem as memory usage, if it keeps taking up the reservations on the heap. I downloaded ANTS Profiler (trial version) and trying to look at it this way. initially it looks the same ( using memory up ) but I need to use the tool more so I can understand what I am looking at better. Thanks Dave.

          D 1 Reply Last reply
          0
          • M mtone

            What is the affect on the system if that number continues to grow. Like you said it is reserved but doesn't that have the same kind of problem as memory usage, if it keeps taking up the reservations on the heap. I downloaded ANTS Profiler (trial version) and trying to look at it this way. initially it looks the same ( using memory up ) but I need to use the tool more so I can understand what I am looking at better. Thanks Dave.

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

            The .NET CLR will hold onto the memory until either your application allocates more objects or Windows wants memory. In the later case, the CLR will release blocks of memory back to the system until Windows in happy. The .NET Garbage Collector does a really good job of managing memory for you. Now, that doesn't mean that your app isn't allocating objects and not releasing them! That's where the Profiler comes in handy. It takes a bit of reading the documentation to figure out what you're looking at. Dave Kreskowiak Microsoft MVP - Visual Basic

            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