Memory Problem [modified]
-
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
-
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
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; }
-
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
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
-
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
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.
-
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.
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