-
[2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
Hey, I'm tossing up reducing the MaxWorkingSet of my application, because it's using 50,000K Memory, but it does less than notepad.
I'm wondering if there is a way I can determine a realistic MaxWorkingSet for my application?
Cheers
Icyculyr
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
The Task Manager doesn't show the actual memory in use by a .NET app. It shows the memory allocated to the app. Remember that the .NET Framework handles memory management automatically. If the system needs that memory and your app isn't using it then it will be reclaimed, as needed. You're just trying to make your life difficult. It's a very rare thing that you should have to worry about your app's memory usage. As long as your disposing the objects you should and nulling the variables that you should then the system will handle the rest.
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
I know, but on the application startup event of another thread, I've set my processes MinWorkingSet to 12000K, and the task manager shows it using 8-9,000K and MaxWorkingSet to 25000K
I've tested, and even if I increase min working set, no change occurs, so maybe messing with those things did something good?
Because, instead of that small application that uses less memory than notepad, using 50,000K memory, it's now at 9,000K
So I wonder, what was the .NET Framework thinking?!
Cheers
Icyculyr
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
It was probably thinking that memory was nearly free. Why are you worrying about this? As JM pointed out, the OS will reclaim that excess memory if it needs to. If the OS doesn't need it, then why add some hoops to jump through, just let the app gobble up 50MB, who does it hurt? There is no performance cost, and the memory won't be recovered in most situations because there is so much memory on systems these days. You're creating a problem that doesn't exist.
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
Hmm, then I will leave my main application alone, but I refuse to let my mini application that does nothing, use 50mb memory, as long as it won't cause it to break, for any reason, then I'm fine...
Cheers
Icyculyr
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
oh actually there is a problem, my application's notify icon doesn't show until all the memory is loaded (roughly, give or take 5MB), so if it waits until 20MB, it loads in about 10 seconds, 50-70MB? it takes about 1 minute...
So that's really why I'm doing it
Cheers
Icyculyr
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
Icyculyr, I tell this to everyone who talks about memory usage and .NET
when your app is loaded, look at its entry in the taskmanager, note how much memory it is using.
Now minimize your application to the taskbar, note how much memory its using.
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
Ok, I'll do that, but it doesn't solve the problem of why I'm modifying it in the first place, more memory it loads (50-70MB) longer it takes before my notify icon shows in the system tray...
(Which notify icon is shown in my Form1_Load event, so that tells me, smaller memory to load, faster Form1_Load event runs...
Cheers
Icyculyr
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
That doesn't sound like the typical memory question. It sounds like you are actually using this 50MB. You say the app is smaller than NotePad, but when you talk about loading like that, you aren't just talking about the app loading, are you? Some kind of data is loading.
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
Sorry, I'm talking about two different application's in the same solution, at the same time.
50MB memory for small app, and 50MB memory for main application...
the main one, should take load really fast, it does load a lot of data in the Form1_Load event, and I find it loads in 10 seconds, if I've changed it's WorkingSet (Min & Max) to something else (Doesn't matter what as long as Min > Max), If I haven't made that change, it loads to 50-60MB of memory, and takes about 1 minute..
the small app, I don't want to "seem" to be using 50MB app, when it's not.
Cheers
Icyculyr
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
Something is going wrong in the big app. We have been talking about the appearance of using memory. An app can appear to allocate 50MB just as easily as it could appear to allocate 1GB, or 1MB. All take the same length of time. However, in your big app, there is certainly a difference in loading for the two, which means that something is actually happening during that load. You seem to know what it is. It seems like you might consider some kind of background load.
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
Everything that can be put onto a background thread has been, but that doesn't explain why changing the amount of memory for my program to load, changes the amount of time before it starts loading...
IE, if I modify MinWorkingSet to 25MB, it loads in 10 seconds, if I don't, it takes 1 minute...
That doesn't make sense to me..
Cheers
Icyculyr
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
well you haven't really mentioned what your applications even does, so its really hard to give you any kind of advice. I can tell you that I have tons of apps in production written in .NET and I haven't had to do any of my own memory management, and everything works fine because I manage the lifecycle of my objects well and also understand how and when to load things to memory especially during application startup.
It sounds like this high memory usage is a result of some inefficient coding
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
So, that inefficient coding would occur in my load event?
My actual memory usage of my application when debugging is only 30-36MB..
Cheers
Icyculyr
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
probably.
If you have code in the form load that can cause your app to take a minute to start working, then yes there is something wrong with your code.
-
Re: [2008]Do VB apps require heaps of memory, or just have a high MaxWorkingSet?!
Alright, thanks, I'm going to keep experimenting and see where I get.
Cheers
Icyculyr