What is a good memory profile?

When designing any desktop application, are there general rules about how much memory an application should use?

For heavy-weight apps, they can be easily understood or at least profiled like Firefox or Google Chrome. But for small utilities or business applications, how much memory is acceptable?

I asked because I recently faced a trade-off between memory usage and performance and wonder if there is a general consensus on this?

EDIT: The platform is Windows XP for users with a machine just capable of running rich internet applications.

My particular tradeoff issue is caching a lot of images in memory. If possible, I would like my application cache to be as large as user memory allows. I made it so that the application would cache up to a certain maximum limit given the memory pressure at the moment.

But what's a good number? How did you come up with it? This is what I am asking for.

0


source to share


3 answers


There is no absolute answer to this question. It depends on too many variables.

Here are some tradeoffs to consider:

  • What device / platform are you developing?
  • Do you expect your user to use this software as the primary target for their computer (for example, perhaps you are developing some kind of server software).
  • Who is your target audience, home users? experienced users?
  • Are you making realistic expectations about the amount of RAM the user will have?
  • Do you take into account that the user will be using many other software on this computer as well?

Sometimes you can get a cake and eat it too. For example, if you were reading a file and writing it back, you could read it in chunks instead of reading the entire file in memory and then writing it. In this case, you will have more memory usage and no speed reduction.



I would recommend using more RAM to get better speed if needed. But only if the RAM requirements are realistic for your target audience. For example, if you expect a home user to have 1 GB of RAM to use your program, then don't use 600 MB of RAM.

Consider using more RAM in this case to get better speed and optimize some of the other part of your code to use less RAM.

Edit:

About your specific image caching situation. I think you would be better off if you allowed the user to set the amount of caching they would like to do as an option. Thus, people with a lot of RAM can improve its performance, while people with little RAM can lower it.

+2


source


It totally depends on your target platform, which is more or less a business decision. The more memory you need, the fewer clients your software can use. Some questions: How much memory have your clients (or potential clients) installed on their computers? What other applications will run concurrently with your application? Is your application supposed to be running exclusively (like a full-screen PC game) or is it a utility that needs to run mostly in the background, or switches to it frequently from other applications?

Listen to one example of a survey showing the distribution of installed RAM across the systems of people playing games on Steam (source: Valve - Survey Summary ):



  • Less than 96 MB 0.01%
  • from 96 Mb to 127 Mb 0.01%
  • 128 MB to 255 MB 0.21%
  • 256 MB up to 511 MB 5.33%
  • 512 MB up to 999 MB 19.81%
  • 1 GB up to 1.49 GB 30.16%
  • 1.5 GB up to 1.99 GB 6.10%
  • 2.0 GB 38.37%

The conclusion I would draw from a survey like this one on my domain (PC games), I can reasonably expect that almost all of our users will have 512MB or more, and the vast majority of which will have 1GB or more. For a PC game that is supposed to run exclusively, this means that a working set of around 400MB is safe enough and won't limit almost anyone, and if it provides significant added value to the product, it might make sense to have a working set of around 800MB.

+1


source


It depends on your target PC. If your application is using too much memory, it will be slow during windowing. TEST! Try both in your trade-off, and some in between, if that makes sense. Run your tests on a typical machine that your users will use and with a number of other applications open. So for most people this is Outlook and probably an instance of or 2 Internet Explorer (or an email client / browser of your choice). I work in a body where using my app is also likely to work with some other custom apps, so we're testing those that work as well. We found that our application uses too much memory and makes the switching application painfully slow.so we slowed down our application a bit to reduce its memory usage. If you are interested in our target hardware, then 512 MB hardware was originally created because it was our common standard workstation. Several PCs had to upgrade to 1GB though due to this app. We've now trimmed its RAM usage a little bit, but it's written in VB.NET and most of the memory used seems to be the basis. PerfMon says the process is using aroung 200Mb (peak), but the managed heap is only about 2Mb!We've now trimmed its RAM usage a little bit, but it's written in VB.NET and most of the memory used seems to be the basis. PerfMon says the process is using aroung 200Mb (peak), but the managed heap is only about 2Mb!We've now trimmed its RAM usage a bit, but it's written in VB.NET and most of the memory used seems to be the basis. PerfMon says the process is using aroung 200Mb (peak), but the managed heap is only about 2Mb!

0


source







All Articles