• 0

Reduce .NET app RAM usage


Question

Recommended Posts

  • 0
  Tom Servo said:
Well, what about an option based on my dialog proposal?

Make a dialog that shows up on first run that explains the memory management **** in easy words and then two radio buttons that allow you to choose to use the "memory preserving" option (SetProcessWorkingSetSize) or not.

very good idea actually.....mind if I use it?

  • 0

thanks, for the sake of the laregly n00b crowdthat uses my program, I will only put the option in the options dialog so they don't have to even touch it unless they want to. If I provide a dialog on first run, forget it, half of them will freak lol.

  • 0

Make it a small dialog like

"This is the first time you run this application. Do you want to run this application optimized for enhanced stability or optimized for memory consumption? [LinkLabel]Click here for details.

( ) Stability ( ) Memory"

  • 0

yeah I know, just my g/f is one of those people so when I code, I code for someone with her mindset (meaning how the finished product works), we so I'll have to think about it. What I could just do is put it "stability mode" by default and just let them find the option if they are worried that much. We'll see. I have some time before the next release. Real life work has to come before some freeware project I'm doing. Best Buy is consuming all my time right now. Thanks for the idea though Tom.

  • 0

The dialog's a good idea. BUT I don't think it's a good idea to tell the users you're optimizing for either memory usage or stability. That's a crappy choice to have to make. Though that's really what you're doing, it might be better to phrase it differently.

Maybe a better way would be to grade optimization from none to very aggressive (after all, you don't need to call SetProcessWorkingSetSize with -1,-1; you can give it different values), with the caveat that the more aggressive settings may cause stability problems.

--

Danny Smurf

  • 0

Everybody remember that SetWorkingSetSize only works on NT-based OSes. You'll want to get the OS platform using System.Enviroment to detect whether the function exists and should be called.

However, I am not sure if you can do that. When a VB.NET app starts, does it check the export tables of the referenced DLLs to check if the needed functions exist? I am interested in this too. :)

  • 0

Or you could use:

Process.GetCurrentProcess().MinWorkingSet and

Process.GetCurrentProcess().MaxWorkingSet

Those are the .NET way of accomplishing the same thing, and most likely will just ignore Windows 98 (rather than having to implement a check yourself).

--

Danny Smurf

  • 0
  dannysmurf said:
Or you could use:

Process.GetCurrentProcess().MinWorkingSet and

Process.GetCurrentProcess().MaxWorkingSet

Those are the .NET way of accomplishing the same thing, and most likely will just ignore Windows 98 (rather than having to implement a check yourself).

--

Danny Smurf

Oh yeah! It probably would actually throw an exception on Windows 98 and ME, but thats easier because that can just be stuck in a Try block. :)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.