Windows 7 "eats" memory. Is it that bad?

Published on April 27, 2010

Windows 7 "eats" memory. Is it that bad?

    On the Internet I heard a lot of angry comments in the style of “Yes Windows 7 - sucks! You look at how it eats memory! ”As proof, screenshots like the one below are given, and again, everything is written off to“ crooked Hindu programmers. ” Let's see how these raids on Microsoft programmers are justified.

    Suppose you purchased a computer with 8 gigabytes of memory. But is it really that what is used on the strength of 1 gigabyte, and all the rest of the memory is idle - so good? With the release of Windows Vista and Windows 7, the approach to using RAM has changed dramatically: now the OS is trying to use all available memory as efficiently as possible. In particular, a feature called SuperFetch appeared in Windows Vista and Windows 7.
    What is SuperFetch?
    SuperFetch is a system service that runs inside the svchost system process. Its code is inside the DLL% SystemRoot% \ System32 \ Sysmain.dll. This service constantly monitors which applications the user launches and which executable and data files they access. All this information is stored in files with the * .db extension in the% SystemRoot% \ Prefetch directory. Why is this all done? But for what: the SuperFetch service, having information about which applications the user works most often - in advanceloads the appropriate code and data into memory, and when the user launches his application, all the necessary information is already in memory, and the launch is much faster - because there is no need to read information from the hard drive. This is especially noticeable on such "heavy" applications as the MS Office family, the functionality of which can be "spread out" over dozens and hundreds of exe-shnikov and dll-ok. SuperFetch is so “smart” that it can even determine the user's preferences on different days and times of the day - for example, that on weekdays he works with Word and Excel, and on weekends he plays Call of Duty, and, accordingly, loads in memory needed data. Accordingly, this memory area is marked as “occupied”, which is displayed in the Task Manager, creating the impression of “memory leaks”. However,
    If some application, for example, terminates its work and frees up memory, then SuperFetch turns to the memory manager with a request to load the newly unloaded code and data. This process takes place at a low speed and with a low (Very Low) priority, so the work of SuperFetch does not lead to a drop in performance. If, for example, you move away to smoke, and at this time a background process that needs memory (for example, anti-virus scan) starts, then the code and data of the application you worked with will probably be unloaded from memory. Thanks to SuperFetch - by the time you return from a smoke break - the data of your active application will be fully or partially loaded back into memory.
    Moreover, SuperFetch can handle hibernation, hibernation, and fast user switching. For example, if the system goes into hibernation, then SuperFetch saves in the hiberfil.sys file the code and data of those applications that, in his opinion, are most likely to be used after exiting hibernation. How is this “opinion” formed? It’s very simple - Big Brother SuperFetch looks after you, and what you started after exiting previous hibernations, and based on this, you can assume that the next time you exit hibernation, you’ll probably launch ICQ and open your favorite browser to read "habrahabr". Well, after an hour or two - you open Visual Studio, because the project is on fire, and the deadline is “yesterday”.

    You can observe how SuperFetch works using the same Task Manager:

    If you poyuzat Windows Vista / 7 for a while, you will notice that the amount of free memory is reduced. This is due to the fact that the SuperFetch standard Windows system cache is trying to recycle the available memory for caching data from disk. For example, if you run Task Manager right after loading Windows, you can see that Free Memory is decreasing, and Cached Memory is increasing. If you run some “memory hungry” program, or just start copying a large file, Free Memory will increase and the “Physical Memory Usage” graph will drop sharply, because the system will free up memory for the running application, but then it will begin to grow slowly - because the application itself will begin to take this memory. However, over time, SuperFetch will load recently downloaded data into memory,

    I hope it was interesting. Thanks for attention. Questions and Matyuki - well in kamenty.

    Based on the article by Mark Russinovich's article “Inside the Windows Vista Kernel”

    PS A similar feature is not only in Windows. In particular, it is also on Linux, and is called Preload. Linuxsoids can comment.