Windows 8 and 8.1 Forums

Reducing runtime memory in Windows 8

  1. #1

    Reducing runtime memory in Windows 8

    Fundamentals such as memory usage represent a key engineering tenet of Windows 8. In building Windows 8 we set out to significantly reduce the overall runtime memory requirements of the core system. This is always good for everyone and especially in a world where people want to run more and more apps at the same time or run on systems with only 1 or 2GB of memory. The laptop we talk about in this post is the exact same one we talked about at the Windows 7 PDC in 2008 – an off-the-shelf, first-generation, ATOM-based netbook with 1GB of memory. This post details our efforts around memory footprint and was authored by Bill Karagounis, the group program manager of our Performance team. --Steven
    The runtime memory usage of Windows 8 is an important factor in determining the Windows 8 system requirements, as well as the broadened spectrum of devices that will host Windows 8. As you know, we’re delivering the complete Windows 8 experience on SoC-based devices characterized by low power consumption. This makes it even more important to leave lots of memory available for multiple concurrent apps and to sustain the overall responsiveness of devices.
    Something that might not be obvious is that minimizing memory usage on low-power platforms can prolong battery life. Huh? In any PC, RAM is constantly consuming power. If an OS uses a lot of memory, it can force device manufacturers to include more physical RAM. The more RAM you have on board, the more power it uses, the less battery life you get. Having additional RAM on a tablet device can, in some instances, shave days off the amount of time the tablet can sit on your coffee table looking off but staying fresh and up to date.
    Memory usage goals

    Our goal with Windows 8 from the beginning was to ship with the same system requirements as Windows 7. We know if we do even better that there are more resources for apps, even if we keep the published requirements the same. It is fun to think about what the "low end" hardware looked like in 2009 and how you can't even find things like 256MB memory modules anymore. We wanted to ensure that people running on Windows 7-era hardware would have the option to easily upgrade their existing machines to Windows 8 and take advantage of the functionality it has to offer. We also expect that many machines that predate the Windows 7 release will run Windows 8 based on the experiences we’ve had with older machines we intentionally keep in our performance test infrastructure.
    An important task for Windows 8 was to make room for new functionality while looking for opportunities to reduce the memory consumed by existing functionality and consumed across the board. Windows 8 is tracking well towards meeting the goal we set ourselves.
    Task Manager memory use comparison

    The easiest way to make a ballpark comparison of Windows 8 vs. Windows 7 memory use is to install both operating systems on a 1GB RAM machine (minimum OS RAM requirement) and compare them when they’ve been rebooted multiple times, and then idled for a while.
    The Windows Task Manager contains the main view of system memory through its “In Use” statistic (described in detail in this doc). The below graphics compare memory consumption on Steven’s 3+ year old netbook that he was using at the //build/ keynote recently, running Windows 7 at idle, and then with the same machine running Windows 8.
    Figure 1 – Memory usage in Windows 7 SP1Figure 2 – Memory usage in Windows 8
    The specific hardware making up a machine, memory use of drivers, and even uptime can cause variability, so memory results will be different on different machines (or even the same machine at different times). As you can see though, Windows 8 is doing well relative to Windows 7.
    For a bit of extra fun on a test machine, go to device manager and disable your display adapter (unload the graphics driver). You’d never run your machine this way but this does give you an even closer approximation of the memory use of Windows itself. With a disabled graphics driver, the machine above gets under 200MB after idling for a while.
    NOTE: For Windows 8, a clean install also contains the extended Windows Defender technology, which, for the first time incorporates complete antimalware functionality – also optimized for memory and resource use per Jason’s blog about protecting you from malware. (This functionality does not exist on a clean install of Windows 7 where we would recommend that you add security software).
    Making room in Windows 8

    We made hundreds of specific changes to minimize OS memory use in Windows 8. I’m going to call out a few specific areas that resulted in substantial memory savings.
    Memory combining

    When assessing the contents of RAM in a typical running PC, many parts of memory have the same content. The redundant copies of data across system RAM present an opportunity to reduce the memory footprint even for services and OS components.
    How can this happen? Applications will sometimes allocate memory for future use and will initialize it all to the same value. The application may never actually use the memory as it may be there in anticipation of functionality that is the user never invokes. If multiple running applications are doing this at the same time, redundant copies of memory are in the system.
    Memory combining is a technique in which Windows efficiently assesses the content of system RAM during normal activity and locates duplicate content across all system memory. Windows will then free up duplicates and keep a single copy. If the application tries to write to the memory in future, Windows will give it a private copy. All of this happens under the covers in the memory manager, with no impact on applications. This approach can liberate 10s to 100s of MBs of memory (depending on how many applications are running concurrently).
    Service changes and reductions

    OS services configured to run all the time are a significant source of ambient memory use. When assessing the set of OS services during Windows 8 planning, we decided to remove a number of them (13), move a different set of services to “manual” start, and also made some of the “always running” services move to a “start on demand” model. This is where a “trigger” in the OS (like device arrival or the availability of a network address) causes the following to occur:
    1. The service starts.
    2. The service does its thing (whatever that happens to be).
    3. It hangs around for a while to make sure there isn’t anything else to do, and
    4. The service goes away.
    You’ll notice that Plug and Play, Windows Update, and the the user mode driver framework service are all trigger-started in Windows 8, in contrast to Windows 7, where these services were always running.
    Of course we have added a ton of new functionality (and new code) to Windows 8. Some of this new functionality is packaged in the form of new services. Of these new services, two are auto-started; all others are manual or trigger-started.
    Doing the same job with less memory

    As Windows executes applications and performs its own system housekeeping, program files and data are loaded off the disk into main memory. During Windows 7 and Windows 8 development to date, we’ve analyzed the pieces (pages) of memory during normal execution and how often they were referenced. The idea here is that if you’re going to pay the price for allocating a piece of memory, you’d better be using it (referencing it) often. If you’re not referencing that memory often but need it, consolidate it with something else.
    Shortly after we shipped Windows 7, we applied a similar technique to several of the low level components of Windows dating back to the early days of NT (early 1990s). The work included re-architecture of code and changing data structures to completely separate “hot” parts of memory (frequently referenced) from “cold” parts. By densely consolidating the hot items, we brought down the overall runtime memory cost.
    Given the nature of the changes (low-level OS), we wanted to get the work done as early as possible in the schedule to get ample runtime on the changes. To date, these changes have been in place on Windows 8 for almost 2 years with thousands of Microsoft employees using the product to get their daily jobs done. And we’ve seen consistent results showing memory usage reduced by tens of MB on an average machine.
    Lazy initialization of the “desktop”

    Back in June, you saw Steven and Julie introduce the Metro style UI for the first time. We expect many people using tablets to spend a lot of time in that environment, typically using Metro style apps. As part of that demonstration, we also showed that for Windows 8, you can also bring forward your existing applications and use them in the very familiar desktop environment.
    From a memory perspective, we’ve taken advantage of the fact that there will be some set of devices on which users will stay in the immersive, Metro style UI almost all the time. In this instance, Windows 8 will only initialize OS components unique to the desktop environment when necessary. This is another source of memory savings, approximately 23MB right now. (Note that Task Manager runs in the desktop, so the memory numbers shown above include its cost).
    More granular prioritization of memory

    Windows 8 has a better scheme for the prioritization of memory allocations made by applications and system components. This means that Windows can make better decisions about what memory to keep around and what memory to remove sooner.
    For example, antivirus programs (AV) do various checks on files when they are being opened by other programs. The memory that the AV program allocates to check virus signatures is usually a one-time allocation (it is unlikely that specific memory will be needed again). On Windows 7, the memory is treated as if it had the same priority in the system as other memory (say, memory allocated by a running instance of Microsoft Excel). If memory became scarce, Windows 7 could end up removing the memory that helps another running application (like Excel) stay responsive for the user, which wouldn’t be the best choice for system responsiveness in this case.
    In Windows 8, any program has the ability to allocate memory as “low priority.” This is an important signal to Windows that if there is memory pressure, Windows can remove this low priority memory to make space, and it doesn’t affect other memory required to sustain the responsiveness of the system.
    To wrap up, I’ve called out our philosophy and approach to reducing memory usage in Windows 8. You’ve seen some sample results and I’ve just scratched the surface on some of the engineering work done to date in this area. One thing I haven’t discussed at all is the Windows 8 application model, and process lifecycle changes made to make new Windows 8 apps more “memory friendly.” Look out for this in the //build/ content and in future blog posts, as it’s also a really important part of the story of reimagining Windows.
    We’ve already come a long way but we’re not done.
    --Bill Karagounis


      My System SpecsSystem Spec

  2. #2

    Posts : 86
    Windows 7 x64

    This just shows you what I have been saying for a long time. The programs have become sloopy and they just went ahead and pushed more and more onto the hardware instead of cleaning up the sloopy programing. Microsoft, with Windows 8, is just cleaning up the programing with Windows 7. Other then the UI the diffrence between Windows 7 and 8 will be hard to see.
      My System SpecsSystem Spec

  3. #3

    Posts : 584
    Windows 8 Dev Preview x64

    But if, like you say, they are cleaning up the programming, then why will the difference be small? Wouldn't we see a big difference?
    Oh well, all in due time, I guess...
      My System SpecsSystem Spec

  4. #4

    Posts : 86
    Windows 7 x64

    No, it will be more stable and use less hardware. Small things add up in programing. If you look at the pics you can see a major diffrence. 100 MB of ram adds up on a notebook. If there is a gain of 100 MB of ram per 1 GB of ram in a 24 GB of ram in a computer that is a savings of 2.4 GB of ram. On a computer doing sims like I do at work this adds up. That would save for me a full day of sim.
      My System SpecsSystem Spec

  5. #5

    Posts : 476
    WCP / Win.7 Ultimate 64-bit SP1.

    RAMorexic Windows 8 Runs on 64MB of Memory

    Cutting down the overall runtime memory requirements of the core system was one of the key engineering tenets of building Windows 8, according to Steven Sinofsky, President, Windows and Windows Live Division.

    As such, not only is Windows 8 tailored to the same system requirements as Windows 7, but its also sporting a consistent collection of memory usage optimizations set up to boost responsiveness on a range of devices, including those equipped with SoC architectures, get concurrent applications running smoothly, and even prolong battery life by minimizing energy consumption.

    We made hundreds of specific changes to minimize OS memory use in Windows 8, revealed Bill Karagounis, the group program manager of the Performance team.
    RAMorexic Windows 8 Runs on 64MB of Memory - Softpedia
      My System SpecsSystem Spec

  6. #6

    Posts : 584
    Windows 8 Dev Preview x64

    WHAT?! That is incredible. There are no words.

    Sure, it's not usable... But... Dayum!
      My System SpecsSystem Spec

  7. #7

    Tropical Island Pair a Dice
    Posts : 3,030
    Windows 8.1 Pro x64/ Windows 7 Ult x64

    That is quite a feat, better memory management is a much needed jump forward.
      My System SpecsSystem Spec

  8. #8

    Posts : 4,515
    Vista and Win7

    For the average user that will not mean very much. With the default of 4GB of RAM on todays systems, 100MB plus or minus are insignificant - unless you do very special applications like Sim.
      My System SpecsSystem Spec

  9. #9

    Posts : 584
    Windows 8 Dev Preview x64

    Quote Originally Posted by whs View Post
    For the average user that will not mean very much. With the default of 4GB of RAM on todays systems, 100MB plus or minus are insignificant - unless you do very special applications like Sim.
    Whilst that's true, you have to concede that it is a pretty cool feat. I just want to see them lessen the bloating of Explorer and other built-in processes...
      My System SpecsSystem Spec

  10. #10

    Posts : 476
    WCP / Win.7 Ultimate 64-bit SP1.

    Microsoft Details Drastic Memory Improvements In Windows 8

    When Windows 7 was released, Microsoft had set out to erase the bad rap Windows had gotten because of Windows Vista, which was notorious for being a memory hog. And now, with Windows 8, Microsoft is aiming to do the same thing on devices with even lower system specs than Windows 7 required, especially because of the rise of tablet devices and SoC based devices that are distinguished by low power consumption. Using up RAM (random access memory) also saps power from the device. Therefore, if an operating system uses a lot of memory, then more physical RAM will have to be built into a device, and bam! less battery life.
    Microsoft Details Drastic Memory Improvements In Windows 8 | Windows 8 Center
      My System SpecsSystem Spec

Page 1 of 2 12 LastLast
Reducing runtime memory in Windows 8

Similar Threads
Thread Forum
Microsoft OCR Library for Windows Runtime Released
Windows 8 News
Runtime broker 5GB memory usage :(
Runtime broker constantly hits 5GB memory usage. It maxes out my RAM, and I can't work. A VMM log is attached for your kind examination. I appreciate your help!
Performance & Maintenance
bsod after reducing available RAM for startup
Greetings, Responding to an error code while attempting an install of arcgis, I reduced the amount of RAM for startup under msconfig, advanced, boot.ini. Now I get the bsod with error code bad_system_config_info. Any recommendations for fix? I can't access Windows in any mode but can get to the...
BSOD Crashes and Debugging
Reducing Volume Amplification?
My audio output is my graphics card via HDMI (ATI HD5770) which is connected with my TV. I need some software/filters or something else to reduce volume amplification in movies? Example, when actors in movies just talking then volume is ok, but if there a war scene then volume jumping up, this...
Sound & Audio
Microsoft Visual C++ Runtime Library- Runtime error DualB
I have Windows 7 Home Pro and Windows 8 Pro installed on 2 separate partitions on my laptop. Every time I switch from windows 7 to windows 8. W8 boots up and I have this error when I log in. "Microsoft Visual C++ Runtime Library" Runtime Error My graphics card is an Amd HD4330. I use the...
Graphic Cards
stuck in Windows Memory Diagnostic: motherboard or memory problem?
After my new build froze up during boot up into Windows 8, I tried to run Windows 8's built-in Windows Memory Diagnostic, extended setting, but it got stuck at 21% of 1st pass (10% overall) after running it overnight (at least 12 hours). I had 4x4GB memory modules, and re-ran this test with only...
Performance & Maintenance

Eight Forums Android App Eight Forums IOS App Follow us on Facebook