📜 ⬆️ ⬇️

Windows 7 "eats" memory. Is it bad?

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

image
Suppose you purchased a computer with 8 gigabytes of memory. But is it really that 1 gigabyte is used at most, and 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: the OS is now 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 located inside the% SystemRoot% \ System32 \ Sysmain.dll DLL. This service constantly monitors which applications the user runs and which executable files and data files they access. All this information is stored in files with the * .db extension in the% SystemRoot% \ Prefetch directory. What is all this done for? But for what: SuperFetch service, having information about which applications the user works most often with, loads the appropriate code and data into memory in advance , and when the user starts his application, all the necessary information is already in memory, and the launch takes place much faster - because there is no need to read information from the hard disk. This is especially noticeable on such “heavy” applications as the MS Office family, the functionality of which can be “spread” on dozens and hundreds of exe-shnik and dll-ok. SuperFetch is so “smart” that it can even define the user's preferences on different days and times of the day - for example, that it works with Word and Excel on workdays, and on weekends it is played in Call of Duty, and, accordingly, it loads in Memory is the right data. Accordingly, this memory area is marked as “occupied”, which is displayed in Task Manager, creating the impression of “memory leaks”. Nevertheless, if some application that requires memory allocation is suddenly launched, the memory manager quietly frees up the necessary space, and after the application completes, the memory is released and the data is loaded again.
If any application, for example, completes its work and frees the memory, then SuperFetch calls the memory manager with a request to load the newly uploaded code and data. This process occurs at low speed and with the lowest (Very Low) priority, so the work of SuperFetch does not lead to a drop in performance. If, for example, you leave to smoke, and at this time a background process starts that needs memory (for example, an anti-virus check), then the code and data of the application that 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 modes, “sleep mode” and user switching (fast user switching). For example, if the system goes into hibernation, then SuperFetch saves into the hiberfil.sys file the code and data of those applications that, in his opinion, are most likely to be used after exiting from hibernation. How is this "opinion" formed? It's very simple - Big Brother SuperFetch is watching you, and what you started after exiting the previous hibernations, and based on that - you can assume that the next time you exit hibernation you will surely launch ICQ and open your favorite browser to read "habrakhabr." Well, after an hour or two, you open Visual Studio, because the project is on fire, and the deadlines are yesterday.

You can observe the work of SuperFetch with the help of the same Task Manager:
image

If for some time Windows Vista / 7, then you will notice that the amount of free memory decreases. This is due to the fact that SuperFetch Standard Windows System Cache is trying to utilize available memory to cache data from the disk. For example, if you run the Task Manager immediately after loading Windows, it is clear that Free Memory is decreasing, and Cached Memory is on the contrary increasing. If you run any memory-greedy program, or simply start copying a large file, Free Memory will increase and the Physical Memory Usage schedule will drop dramatically because the system will free up memory for the running application, but then it will slowly grow. because the application itself will take this memory. However, over time, SuperFetch will load newly uploaded data into memory, so the value of Cached Memory will increase, and Free Memory will decrease.
')
I hope it was interesting. Thanks for attention. Questions and mothers - Wellcome to Kamenta.

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


PS This feature is not only in Windows. In particular, there is it in Linux, and is called Preload. Linuksoids can comment.

Source: https://habr.com/ru/post/92165/


All Articles