Windows Memory Management
I love it when people start quoting memory usage in Windows. I never ever see where the poster gets the figures they are quoting. I’m going to assume it’s from the Task Manager. I have to tell you that is has next to bugger all to do with the amount of memory a program is using in Windows.
I’m writing this in Word 2000 on XP Pro SP3. Currently, Task Manager is reporting 11,998 K used by Word. If I minimise Word’s window, Task Manager shows a figure of 1,044 K. I restore the window and I’m showing 3,114K used.
I’ve tried to get my head around how Windows allocates memory to processes and I’m sure I have not yet understood all of it.
What I think happens is that Windows treats all free memory as a resource to be used. For instance, Windows has just loaded and is as idle as it can be. The user runs an app that displays “Hello, World” in a window. Windows takes a look at how much free ram there is and allocates a wad of it to the new process.
Windows does not know that the app will only need enough ram to display “Hello, World” so it takes a look at the free memory it has and allocates what it sees as a chunk of memory that will be enough for it, plus an extra amount. How this is worked out is beyond me, I just know that’s what Windows does. And it will take away the allocated memory as memory uses increases.
This makes sense, since the app could ask for more memory and get a constant block of memory, rather than a few K here, a few K there. Also bare in mind that ram is the fastest medium available in a PC, so it should be exploited more than a swap file for example.
But it does lead people to believe that a process is consuming a large amount of ram when all that has happened is that Windows has given a large amount of ram to it.
Comparisons of ram usage between Windows and other operating systems are really not valid since the way they allocate memory is likely to be totally different.
I’m not against comparisons, I really don’t give a shit if one O/S is better than another, as long as the person making the comparison has a thorough knowledge of what they are comparing.