Memory usage

Hello!

I wonder why my running processes’ mem usage rises after some time using my PC:

http://www.shrani.si/f/46/pa/VzL9cwS/start.jpg

http://www.shrani.si/f/7/vp/16al4QYs/end.jpg

Can you explain hot this works and if that’s normal? Thank you! :slight_smile:

Absolutely normal.

Alright, but why is that so? Why the mem usage goes up (I have the same 29 processes running on both pics)?

Because “a lot of programs do this, they take memory but don’t always cleanup after themselves.”

Quoted:


  • At the end of the call the memory is no longer used but still being taken up by the program because I didn’t clean it up! A lot of programs do this, they take memory but don’t always cleanup after themselves. Well the API (Windows API EmptyWorkingSet) is like a little house cleaning. It removes all safe unused memory. When the process runs the function again the memory is then taken again without any difference in performance to the program because it would do it anyways, it wont reuse the old memory, this is why you see program climb and climb in memory usage as you use them. So why let all the unused memory just sit there?

Source: [url=http://www.pcwintech.com/cleanmem][b]CleanMem[/b][/url] (an excellent tool)

Sorry, but that’s… nonsense.
First, having a memory in working set has nothing do to with “not cleaning up”.
Second, it’s not true that “when the process runs the function again, the memory is taken again without any difference in pefrormance” - the program has to read the data back from disk or swap file - that’s a significant perfromance difference! (even though just one time).

If Windows needs more memory for something, it will do the cleanup itself. So, this tool basically interferes with Windows memory managment, most likely degrading the performance, not improving it.

“So why let all the unused memory just sit there?” - that’s a wrong question. The right question is - why do you have so much RAM in your computer when you don’t want to use it?!
That’s really great, having a lot of free (i.e. useless) memory in your machine - while the running programs who could take advantage of it to run faster, struggle with as little as possible, (re)reading the stuff from disk instead.

Sorry, but API EmptyWorkingSet isn’t API SetProcessWorkingSetSize exactly. From Microsoft:

When you increase the working set size of an application, you are taking away physical memory from the rest of the system. This can degrade the performance of other applications and the system as a whole. It can also lead to failures of operations that require physical memory to be present (for example, creating processes, threads, and kernel pool). Thus, you must use the SetProcessWorkingSetSize function carefully. You must always consider the performance of the whole system when you are designing an application.

And the question is “a lot of programs don’t always cleanup after themselves”. Windows will do that if needed - but not a lot of applications themselves definitively. Like in OP post example.