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.
[h=3]Memory usage goals[/h]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.
[h=3]Task Manager memory use comparison[/h]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).
[h=4]Making room in Windows 8[/h]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.
[h=4]Memory combining[/h]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).
[h=4]Service changes and reductions[/h]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.
[h=4]Doing the same job with less memory[/h]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.
[h=4]Lazy initialization of the “desktop”[/h]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).
[h=4]More granular prioritization of memory[/h]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

aggbug.aspx

More...
 
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 Computer

System One

  • OS
    Windows 7 x64
    System Manufacturer/Model
    Asus
    CPU
    Intel Core i7-2600K Sandy Bridge @5.00 GHz
    Motherboard
    ASUS Maximus IV Extreme-Z LGA 1155
    Memory
    2 x Corsair Dominator 2GB DDR3 @1866 (Old DDR3 1600 Sticks, plan to upgrade)
    Graphics Card(s)
    ATI 4850 (I know it's old, plan to upgrade, taking donations)
    Sound Card
    Realtek ALC889
    Monitor(s) Displays
    Sony Bravia KDL-32EX500
    Screen Resolution
    1980x1080P
    Hard Drives
    1 x Corsair Force Series GT CSSD-F60GBGT-BK Windows
    2 x Western Digital Caviar Black Sata III 750GB (Raid 0)Programs
    1 x Western Digital Caviar Black Sata III 1TB - Media
    2 x Western Digital Caviar Black Sata II 640GB (Raid 0) Mac OS X
    PSU
    Corsair Professional Series Gold AX850
    Case
    Corsair 800D
    Cooling
    Corsair H80 High Performance Liquid CPU Cooler
    Keyboard
    HP Wireless Elite Keyboard
    Mouse
    HP Wireless Elite Mouse
    Internet Speed
    DSL, VisionTek Bigfoot Killer 2100 Gaming Network Card and Internaly Installed Linksys WUSB600N
    Other Info
    4 x GELID Solutions FN-TX12-15 120mm Case Fan with Superior Temperature Control
    1 x Corsair 140mm Case Fan
    1 x SilverStone FP55B Aluminum front panel 5.25" to a 3.5" bay converter
    1 x Ultra Card Reader
    1 x Sony Blu-ray Burner BD-5300S-0B
    1 x 2GB Internaly Installed Flash Drive For Mac OS X Boot
    1 x Internal USB 3.0 Header to 2 USB 3.0 Female Adaptor
    1 x ATI TV Wonder™ Digital Cable Tuner
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 Computer

System One

  • OS
    Windows 8 Dev Preview x64
    CPU
    i7 950 3.06GHz
    Motherboard
    Asus Rampage III
    Memory
    G Skill 4GB DDR3 2000MHz
    Graphics Card(s)
    Nvidia GTX570 1.25GB DDR5
    PSU
    Antec ATX TruePower 750W
    Case
    Antec Lanboy Air Red
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 Computer

System One

  • OS
    Windows 7 x64
    System Manufacturer/Model
    Asus
    CPU
    Intel Core i7-2600K Sandy Bridge @5.00 GHz
    Motherboard
    ASUS Maximus IV Extreme-Z LGA 1155
    Memory
    2 x Corsair Dominator 2GB DDR3 @1866 (Old DDR3 1600 Sticks, plan to upgrade)
    Graphics Card(s)
    ATI 4850 (I know it's old, plan to upgrade, taking donations)
    Sound Card
    Realtek ALC889
    Monitor(s) Displays
    Sony Bravia KDL-32EX500
    Screen Resolution
    1980x1080P
    Hard Drives
    1 x Corsair Force Series GT CSSD-F60GBGT-BK Windows
    2 x Western Digital Caviar Black Sata III 750GB (Raid 0)Programs
    1 x Western Digital Caviar Black Sata III 1TB - Media
    2 x Western Digital Caviar Black Sata II 640GB (Raid 0) Mac OS X
    PSU
    Corsair Professional Series Gold AX850
    Case
    Corsair 800D
    Cooling
    Corsair H80 High Performance Liquid CPU Cooler
    Keyboard
    HP Wireless Elite Keyboard
    Mouse
    HP Wireless Elite Mouse
    Internet Speed
    DSL, VisionTek Bigfoot Killer 2100 Gaming Network Card and Internaly Installed Linksys WUSB600N
    Other Info
    4 x GELID Solutions FN-TX12-15 120mm Case Fan with Superior Temperature Control
    1 x Corsair 140mm Case Fan
    1 x SilverStone FP55B Aluminum front panel 5.25" to a 3.5" bay converter
    1 x Ultra Card Reader
    1 x Sony Blu-ray Burner BD-5300S-0B
    1 x 2GB Internaly Installed Flash Drive For Mac OS X Boot
    1 x Internal USB 3.0 Header to 2 USB 3.0 Female Adaptor
    1 x ATI TV Wonder™ Digital Cable Tuner
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 it’s 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 Computer

System One

  • OS
    WCP / Win.7 Ultimate 64-bit SP1.
    System Manufacturer/Model
    LAPTOP. HP Pavilion dv7-4010TX .
    CPU
    Intel i7 -720QM.[1.6GHz Turbo Boost 2.8GHz. 6MB Cache.]
    Memory
    8 DDR 3 RAM. 1066MHZ
    Graphics Card(s)
    ATI 1024 MB. DDR3. Radeon HD5650
    Monitor(s) Displays
    17.3" High Definition Brightview LCD. LED Backlit.
    Screen Resolution
    1600 x 900.
    Hard Drives
    640GB
    Case
    Laptop / notebook.
    Cooling
    Of course.Cooler Master 3 fan with various speeds.
    Keyboard
    Does the keyboardless Laptop exist?
    Mouse
    Logitech Anywhere mouse. MX.
    Internet Speed
    Too slow.
    Other Info
    Nunya...
WHAT?! That is incredible. There are no words.

Sure, it's not usable... But... Dayum!
 

My Computer

System One

  • OS
    Windows 8 Dev Preview x64
    CPU
    i7 950 3.06GHz
    Motherboard
    Asus Rampage III
    Memory
    G Skill 4GB DDR3 2000MHz
    Graphics Card(s)
    Nvidia GTX570 1.25GB DDR5
    PSU
    Antec ATX TruePower 750W
    Case
    Antec Lanboy Air Red
That is quite a feat, better memory management is a much needed jump forward.
 

My Computer

System One

  • OS
    Windows 8.1 Pro x64/ Windows 7 Ult x64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    76~2.0
    CPU
    Intel Core i5-3570K 4.6GHz
    Motherboard
    GIGABYTE GA-Z77X UD3H f18
    Memory
    8GB (2X4GB) DDR3 1600 CORSAIR Vengeance CL8 1.5v
    Graphics Card(s)
    Sapphire HD 7770 Vapor-X 1GB DDR5
    Sound Card
    Onboard VIA VT2021
    Monitor(s) Displays
    22" LCD Dell SP2208WFP
    Screen Resolution
    1680x1050
    Hard Drives
    Samaung 840Pro 128GB, Seagate 500GB SATA2 7200rpm 32mb, Seagate 1TB SATA2 7200rpm 32mb,
    PSU
    Corsair HX650W
    Case
    Cooler Master Storm Scout
    Cooling
    Corsair H80 w/Noctua NF P12 12cm fan, case fans 2X14cm
    Keyboard
    Logitech Wave
    Mouse
    CM Sentinel
    Internet Speed
    Abysmal
    Browser
    Opera Next
    Other Info
    Dell Venue 8Pro: Baytrail Z3740D, 2GB Ram, 64GB HDD, 8" IPS Display 1280 x 800, Active Stylus.
    Haswell laptop: HP Envy 17t-j, i7-4700MQ, GeForce 740M 2GB DDR3, 17.3" Full HD 1920x1080, 16GB RAM, Samsung 840 Pro 128GB, 1TB Hitachi 7200 HDD,
    Desktop: eSATA ports,
    External eSATA Seagate 500GB SATA2 7200rpm,
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 Computer

System One

  • OS
    Vista and Win7
    System Manufacturer/Model
    2xHP, 2xGateway, 1xDell, 1xSony
    Hard Drives
    5 SSDs and 12 HDs
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 Computer

System One

  • OS
    Windows 8 Dev Preview x64
    CPU
    i7 950 3.06GHz
    Motherboard
    Asus Rampage III
    Memory
    G Skill 4GB DDR3 2000MHz
    Graphics Card(s)
    Nvidia GTX570 1.25GB DDR5
    PSU
    Antec ATX TruePower 750W
    Case
    Antec Lanboy Air Red
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 Computer

System One

  • OS
    WCP / Win.7 Ultimate 64-bit SP1.
    System Manufacturer/Model
    LAPTOP. HP Pavilion dv7-4010TX .
    CPU
    Intel i7 -720QM.[1.6GHz Turbo Boost 2.8GHz. 6MB Cache.]
    Memory
    8 DDR 3 RAM. 1066MHZ
    Graphics Card(s)
    ATI 1024 MB. DDR3. Radeon HD5650
    Monitor(s) Displays
    17.3" High Definition Brightview LCD. LED Backlit.
    Screen Resolution
    1600 x 900.
    Hard Drives
    640GB
    Case
    Laptop / notebook.
    Cooling
    Of course.Cooler Master 3 fan with various speeds.
    Keyboard
    Does the keyboardless Laptop exist?
    Mouse
    Logitech Anywhere mouse. MX.
    Internet Speed
    Too slow.
    Other Info
    Nunya...
But what about that bit on low priority memory? That certainly seems interesting. It looks like they are focusing much more on the management of the memory, not the streamlining of it. At least that's what I got out of the article.
 

My Computer

System One

  • OS
    Windows 8 Dev Preview x64
    CPU
    i7 950 3.06GHz
    Motherboard
    Asus Rampage III
    Memory
    G Skill 4GB DDR3 2000MHz
    Graphics Card(s)
    Nvidia GTX570 1.25GB DDR5
    PSU
    Antec ATX TruePower 750W
    Case
    Antec Lanboy Air Red
Memory management began in earnest with Win7 (not "streamlining").

Win8 8102 is just taking it to a new level, Avalon.
 

My Computer

System One

  • OS
    Windows 8, x64, DP8102 - Win7 Ultimate x64, Dual Boot
    System Manufacturer/Model
    Toshiba
    CPU
    Core 2 Duo T5500
    Motherboard
    Intel
    Memory
    4 GB
    Graphics Card(s)
    Intel 965
    Monitor(s) Displays
    Laptop 17", Gateway 20"
    Screen Resolution
    1440x900 (x2)
Memory management began in earnest with Win7 (not "streamlining").

Win8 8102 is just taking it to a new level, Avalon.
Yes, but it just seems like the focus is to use as much RAM as possible and delete active blocks to make room for other apps, rather than trying to make other processes run on as little RAM as possible...
Or in other words, they're trying to make desktops more like smart-phones... at least from what I've learned so far.
 

My Computer

System One

  • OS
    Windows 8 Dev Preview x64
    CPU
    i7 950 3.06GHz
    Motherboard
    Asus Rampage III
    Memory
    G Skill 4GB DDR3 2000MHz
    Graphics Card(s)
    Nvidia GTX570 1.25GB DDR5
    PSU
    Antec ATX TruePower 750W
    Case
    Antec Lanboy Air Red
Back
Top