https://eclecticlight.co/2022/02/22/windowserver-is-hungry-for-memory-on-m1-macs/ Skip to content [eclecticlight] The Eclectic Light Company Macs, painting, and more Main navigation Menu * Downloads * M1 Macs * Mac Problems * Mac articles * Art * Macs * Painting hoakley February 22, 2022 Macs, Technology WindowServer is hungry for memory on M1 Macs Several of you have reported that WindowServer hogs your CPU, and may consume large amounts of memory too. A few have suggested it might have a memory leak, although no one has provided any evidence to support that. This article looks at WindowServer's use of resources in Monterey 12.2.1, on both Intel and M1 Macs, to see if there's evidence of a problem. To assess this, I looked at the CPU % and memory usage given by Activity Monitor for the WindowServer (WS) process on two Macs: an iMac Pro with 32 GB of memory, Radeon Pro Vega 56 8 GB graphics and its standard 5K 27-inch display; an M1 Pro MacBook Pro with 32 GB of memory and its standard display. Both were set at their default display resolutions, and had been freshly restarted in Monterey 12.2.1 before testing. Web pages used were rich in content, with static images and text, but none contained streamed video or similarly demanding media. Safari windows had full options, including the Bookmarks sidebar, Favourites and Status bars, and occupied the majority of the screen. Results: Intel When freshly started up with a single Activity Monitor window open, WS used around 1% CPU and 154.6 MB of memory. Adding two large Finder windows increased memory use slightly, to 158.2 MB, but didn't affect CPU. Safari, with a single page open, either its Start Page or a website, had no effect on CPU, and increased memory usage to about 165 MB. Adding further Safari windows steadily increased both CPU and memory usage: * 5 windows CPU 4.3% 172.7 MB * 10 windows CPU 5.0% 181.8 MB * 20 windows CPU 5.6% 198.6 MB These give a good linear regression with an overall memory cost of 1.7 MB per Safari window. When all 20 windows were minimised into the Dock, CPU fell to 1.2% but memory increased further to 214.1 MB. With all 20 converted to tabs within a single Safari window, CPU remained at 1.2% and memory fell back slightly to 207.2 MB. Closing that window and quitting Safari returned WS to 0.9% and 185.8 MB memory usage, leaving the latter slightly higher than it had been before Safari had been opened (158.2 MB). Results: M1 Pro With a single Activity Monitor window open, WS was slightly more demanding in its CPU and memory use than on the iMac Pro, with 2.1% CPU and 192.1 MB memory. These increased slightly with two Finder windows, and with Safari displaying its Start Page or website in a single window. What was unexpected was the significantly higher use of resources with increasing numbers of Safari windows: * 5 windows CPU 20.2% 476.5 MB * 10 windows CPU 26.4% 732.2 MB * 20 windows CPU 17.2% 1230 MB Linear regression here gives an overall memory cost of 50 MB per Safari window, thirty times that of the Intel Mac. Minimisation of all 20 windows again reduced CPU usage, to 2.3%, but didn't change memory usage at all, which remained at 1230 MB. Effects of collapsing all 20 windows into tabs in a single window were similar to minimisation. Closing that window and quitting Safari returned WS to 2.4% CPU and 304 MB of memory, the latter being higher than at the start (211.5 MB) but much lower than its high tide mark. Discussion WindowServer appears to perform well and economically on the iMac Pro, with 8-core Intel CPU and graphics card. CPU and memory usage grows slowly, making it feasible to have plenty of windows open and active. Results of increasing Safari windows on the M1 Pro were a complete surprise: CPU use appeared higher, reaching more than 25%, and memory used grew to well over 1 GB, more than five times that of the Intel Mac. However, as most if not all of this CPU load was borne by the two E cores, those figures for CPU % may be misleading, as they don't take into account the operating frequency of the cores, making comparison with Intel figures impossible. At an overall 1.7 MB per window, WS memory cost of open windows in Safari is modest on the Intel iMac Pro. That contrasts with the figure of 50 MB per window on the M1 Pro, which is thirty times greater. This is so marked in Safari that I checked in other apps including Pages and Numbers, which were more modest in their demands. This difference between Intel and M1 Pro Macs is apparent even when individual windows only contain the Start Page. Even more surprising is the lack of any memory saving when open windows are minimised into the Dock, or converted to tabs in Safari. However, working with tabs instead of windows from the start didn't result in significant additional memory use. Conclusions * On (at least some) Intel models, WindowServer is frugal in its use of resources, requiring as little as 1.7 MB for each additional window in Safari. * On (at least) the M1 Pro, WindowServer uses an additional 50 MB for each window. It's not clear why this is so much greater than on Intel. * Minimising windows into the Dock saves on CPU demands, but doesn't alter memory use at all. * Converting existing Safari windows into tabs doesn't save any memory, but working with tabs in the first instance does. * Interpreting CPU % on M1 models isn't easy, as core frequency is critically important, but not available in Activity Monitor at present. * Opening large numbers of windows on M1 Macs may adversely affect their performance greater than on Intel models. * There's no evidence here of significant memory leaks in WindowServer. If you can explain why there's such a great difference between Intel and M1 Macs, I'd love to hear from you in a comment. Speculative Postscript Thank you for the suggestions, in comments here and on Twitter, that the reason for this difference is the M1's use of Unified Memory. Yes, that has been at the back of my mind throughout. However, I don't know enough about WindowServer to know whether that's reasonable. I had thought that WS is primarily concerned here with compositing rather than rendering, in which case what it does, and the memory requirements, shouldn't differ between the two architectures. However, it might be that the windows it composites for some apps, like Safari, already contain much of their content rendered, and that can therefore be shared direct with the GPU under the Unified model. That still doesn't explain the large differences in memory usage by the WS process. There also doesn't appear to be any way in Activity Monitor to discover how much memory is being shared in that way. So the obvious answer is that differences are due to Unified Memory, but that doesn't explain how or why. It's also important not to assume that the M1 Pro does have higher CPU usage for the same tasks; without information on core frequencies, using CPU% from Activity Monitor is completely misleading, and the higher percentages reported could actually reflect the same rate of instruction retirement, for example. Unfortunately obtaining reliable measurements of core frequency for WS usage isn't easy. Share this: * Twitter * Facebook * Reddit * Pinterest * Email * Print * Like this: Like Loading... Related Posted in Macs, Technology and tagged Apple silicon, CPU, Intel, M1, M1 Max, M1 Pro, macOS 12, memory, memory leak, Monterey, Safari, WindowServer. Bookmark the permalink. 21Comments Add yours 1. 1 [60039afefb65] Iljitsch van Beijnum on February 22, 2022 at 7:55 am Reply The higher memory use could be related to the integrated memory model for graphics. On the Intel side, there is either physical video memory which is not counted in normal memory statistics, or, with integrated graphics, a bunch of main memory is set aside and AFAIK again no visibility into what happens there. Then again, the amounts of memory involved are quite significant, more than what you'd expect for just displaying pages. Or perhaps the ARM architecture claims much more virtual memory address space to do the same thing as x86-64. No easy explanations for the high CPU use. LikeLiked by 2 people + 2 [b4e3ec9f1658] Metin on February 22, 2022 at 10:01 am Reply Right, I've had the same idea. M1 share the main memory for graphics, so one would expect that it uses more of this main memory than an Intel Mac with dedicated graphics memory. However, if that actually explains the amount, I'm not sure. It would mean that these amounts of memory are allocated in the graphic card's memory on Intel Macs, but I don't know if that is how it works. LikeLiked by 1 person o 3 [6986a746f627] hoakley on February 22, 2022 at 10:06 am Reply Please read my postscript above. WS isn't known to render, only to composite. That's normally then passed to the graphics driver and into the graphics card, which aren't part of WS or its memory. Howard LikeLike + 4 [6986a746f627] hoakley on February 22, 2022 at 10:07 am Reply Thank you. I have now addressed that in my postscript. Howard LikeLike 2. 5 [2af76302b284] Duncan on February 22, 2022 at 2:18 pm Reply Wow, thank you for performing such rigorous testing. I'm glad you were able to match the conditions across the two architectures as closely as possible. This area seems like a black box to me, since we don't have adequate tools available to truly probe the graphics system. However I look forward to your continued work and reporting on this topic. One other test I'd be curious to see the results from is what happens (if anything) if you kept those 20 windows open, switched to a different memory-intensive app that forced the memory to swap, and then invoked Expose to bring all those windows back into view (albeit in reduced size). But boy are there a lot of variables involved with all this... LikeLiked by 1 person + 6 [6986a746f627] hoakley on February 22, 2022 at 5:02 pm Reply Thank you. Forgive me if I pass on Expose for the time being! Howard. LikeLike 3. 7 [6a588d04df76] OZ on February 22, 2022 at 3:48 pm Reply > On (at least) the M1 Pro, WindowServer uses an additional 50 MB for each window. Can't reproduce. I don't use Safari, so I was testing on Chrome. But that line says about any new window, not just Safari, so it's wrong. LikeLiked by 1 person + 8 [6986a746f627] hoakley on February 22, 2022 at 5:14 pm Reply Thank you. I'm sorry that you couldn't find the time to read even the previous conclusion, let alone the complete article, to understand the context thus the meaning of that. I'm also sorry that you consider that reproducing tests consists of doing something quite different, and that you couldn't be bothered to provide any results either. Please don't be so rude and dismissive about other people's work when it's you that's at fault. Howard. LikeLike o 9 [6a588d04df76] OZ on February 22, 2022 at 6:01 pm Reply Yeah, that sarcasm is very funny, but I did read the whole article before commenting. I was wondering why most of your conclusions are based on Safari results, and why you are ignoring the fact that without Safari involved there is no big difference in memory footprints. I'm so sorry that you decided to reply aggressively. Have a nice day. LikeLiked by 1 person # 10 [6986a746f627] hoakley on February 22, 2022 at 6:16 pm Reply Thank you. Well, Safari is the bundled browser which most Mac users use. It's also the most common app which users have associated with this 'problem' in WindowServer. Irrespective of those, I made it crystal clear in the description of my methods that I was using Safari. Yet you claimed to try to reproduce my results using a third-party browser which is notoriously different in many respects from Safari. That's not reproducing anything, it's running completely different tests. I also gave you a clue that Safari may be the worst culprit in mentioning that my less systematic testing of apps like Pages and Numbers didn't show as large increases as Safari. Presumably you chose to ignore that information. You also didn't give any results. Above I have quoted carefully measured figures for specific systems, complete with linear regressions. What were your measured memory usage figures for different numbers of browser windows? From what you inferred in your comment, there was no increase at all with increasing numbers of windows, which I find extraordinary, and suggests a methodological error on your part, given that WS requires more memory to composite more windows. At the end of all that, you were rude enough to state that I am wrong, then to accuse me of replying aggressively. Perhaps you should reflect more on what you wrote, and how you dissed my careful work and explicit account in a few careless words. Howard. LikeLike @ 11 [6a588d04df76] OZ on February 22, 2022 at 6:43 pm Because I wasn't rude, Howard. I just underlined one thing that you could easily fix (with just 1-2 words). I prefer the scientific method, so I've tried to repeat your steps using Chrome. It is important to use something else rather than Safari, to check if the issue is in that app, not in the WindowServer itself. So after repeating the steps and closing all the Chrome windows, I've got the same memory footprint for WindowServer. I trust your results, so I concluded that the offender here is Safari, not WindowServer itself. For absolutely pure results we should use a few bundled apps and a few third-party apps, but for this I have no time right now, maybe on this weekend. I could start this conversation less sharply, here I agree LikeLiked by 1 person @ 12 [6986a746f627] hoakley on February 22, 2022 at 10:01 pm Thank you. No problem - so long as we understand that dissing something with a club doesn't pass unnoticed! Although interesting to discover what fares well and what doesn't, without knowing how each app passes its windows to WS, it's hard to draw any useful conclusions. The immediate problem, which is what I set out to investigate, is that some users, commonly of Safari, find WS CPU and memory becoming very large. I hadn't expected to see any significant difference between these Macs, because as far as I'm aware, WS should work the same on every Mac. Although seeing WS return to a similar memory use after closing all windows in interesting and gives useful evidence as to whether it has a significant memory leak, my particular interest is in the amount of memory used by each window, as that's what determines the high tide mark in use. In this case, I suspect Safari renders most of the contents of its window before passing it to WS, while other apps pass more Quartz and Metal content. If WS itself doesn't do any rendering, that could be one reason why Safari is heavier in its use. Another factor is GPU memory in main memory, although I don't understand how that could be attributed to WS. Howard. LikeLike 4. 13 [8220aea54d91] Alex on February 22, 2022 at 5:15 pm Reply I don't understand why WindowServer would take more than 0% CPU when nothing is changing on the screen. What's it doing when it's doing nothing? LikeLiked by 1 person + 14 [6986a746f627] hoakley on February 22, 2022 at 5:30 pm Reply You may find my recent explainer of interest. WS does more than just compositing, and routes input events and more. As I don't write it and it's not Open Source, I'm afraid that's as much as I can tell you. Of course, there's another measurement issue here too: we can only observe WS in apps like Activity Monitor, which frequently change contents of their windows, requiring them to be passed through the compositing process again. Howard. LikeLike o 15 [2af76302b284] Duncan on February 22, 2022 at 6:02 pm Reply "Of course, there's another measurement issue here too: we can only observe WS in apps like Activity Monitor, which frequently change contents of their windows, requiring them to be passed through the compositing process again." Heisenberg's Uncertainty Process LikeLiked by 1 person 5. 16 [163e1c4110b5] Tobias on February 22, 2022 at 6:09 pm Reply Thanks for this article. What makes me confuse is the thing that your WS only takes 198,6MB with 20 Windows open. My Macbook (Intel) instead screams for RAM. Just idling on Desktop with no Applications opened, my WS takes up to 800MB of RAM, and a constantly CPU load (not usage) between 1,1 and 2,3 If I open some applications, my WS raises straight to multiple GB. It just starts after using the Macbook normally. If I left it freshly installed, there is no evidence of WS taking much RAM. But shortly after making the Macbook personal, like installing software, doing individual settings, etc, the WS makes its own thing. Thats my experience from Enduser. MacBook Pro 2017 A1708 LikeLiked by 1 person + 17 [6986a746f627] hoakley on February 22, 2022 at 6:24 pm Reply Thank you. My iMac Pro has a modestly powerful graphics card, with its own 8 GB VRAM. I suspect that your MBP has Intel Iris Plus Graphics 640, which uses up to 1.5 GB shared from main memory. M1 Macs use Unified Memory, in which both CPU and GPU (and other supporting systems) use main memory. Maybe this phenomenon occurs in other Intel Macs which use main memory for their graphics? Howard. LikeLike 6. 18 [940d0416af3c] Marc on February 22, 2022 at 6:32 pm Reply Thanks for another very interesting article. I use a 5k 27-inch iMac (i5) that I leave running 24/7. I have not done systematic any systematic testing but I do find that WindowServer issues usually seem to indicated the need for a restart. WindowServer memory use seems to keep growing over time and can end up taking large amounts of memory. For example, currently after 13 days of up-time, WindowServer is taking up 1.05 GB of ram (only 13 windows open - mostly in the finder). Closing all but two of the windows just caused WindowServe to drop to 1.02 GB. WindowServer CPU usage is usually low but sometimes I see very high CPU usage. (These conditions seem to occur with sluggish performance and usually cause me to do a restart.) LikeLiked by 1 person + 19 [6986a746f627] hoakley on February 22, 2022 at 9:51 pm Reply Thank you. This would be compatible with a small memory leak, which makes it hard to diagnose, and something most Mac users won't experience, as they don't leave their Macs running for days at a time. Of course it might not be a leak in WS itself, which makes it even tougher to trace. You don't say which version of macOS - if this is Monterey I recommend that you report it via Feedback. Howard. LikeLike 7. 20 [0744e1f7752a] Still learning John on February 22, 2022 at 8:03 pm Reply I'm not an expert. Unified memory is almost certainly the culprit on M1. But not in the way others have suggested. If one pays attention to the memory allocation to the GPU on M1, and M1Pro, it becomes evident that rarely is there more than 380MB allocated, even when watching multiple windowed streams of video, while playing games in yet another window. It seems that the GPU ram is merely buffering pre-rendered screen pixels. With all the donkey work being done in cpu managed memory. Meanwhile on Intel systems, the graphics card has all of the data components handed off to it, and must manage all,the pre render data as well as the rendered pixels to be delivered to the screen. I suspect the apple silicon GPU memory allocation is more like a screen buffer, with the GPU's primar activity accessing the same memory space as the cpu to access the data during the render process. Only on systems attached to large external displays will the GPU memory grow significantly. Or perhaps also with poorly coded applications which request higher GPU allocation because they are not optimised for sharing graphics data saved in shared memory space. One would reasonably assume Safari is tuned to be maximally efficient on M1, and while appearing to gobble ram in windowed processes, is actually just ensuring folks like me who multi-task in odd ways are able to do so without issues. After all when watching 6 windowed hi-def video streams each down sized to fit odd shaped windows, with one selected for picture-in-picture overlay, while playing Tanks in another window (yes I know tanks is not that demanding), one could expect issues, and a substantial rendering load. But some how the GPU ram never grows significantly, even when one switches to running a DaVinci Resolve timeline instead of playing Tanks. The Unified memory must indeed be holding much of the raw graphics data, because it is not populating a dedicated 8GB graphics card. And on my M1 mini 8 GB is all there is to play with. Funny thing is my m1Pro 16" uses slightly more of its 16GB of ram in the same usage context, but not really. But then again I do make extensive use of tabs, although I do breakout those tabs from time to time into separate windows. Perhaps my approach of using apps benefits me, as I always , religiously close all tabs, and fully exit applications before taking a break, and I also use private browsing and clear caches frequently. LikeLiked by 1 person + 21 [6986a746f627] hoakley on February 22, 2022 at 10:08 pm Reply Thank you. I'm not sure what you say fits with the known function of WS, though. As far as I'm aware, WS doesn't have anything to do with rendering. All it does it assemble all the windows into a layered composite, and passes that to the driver and GPU to perform the rendering. In Unified Memory, that should actually use less memory, as the finished composite shouldn't have to be transferred anywhere, but can be directly accessed by graphics hardware for rendering. Or are you saying that what Activity Monitor shows as WS memory includes that for the rendering? Howard. LikeLike Leave a Reply Cancel reply Enter your comment here... [ ] Fill in your details below or click an icon to log in: * * * * Gravatar Email (required) (Address never made public) [ ] Name (required) [ ] Website [ ] WordPress.com Logo You are commenting using your WordPress.com account. ( Log Out / Change ) Google photo You are commenting using your Google account. ( Log Out / Change ) Twitter picture You are commenting using your Twitter account. ( Log Out / Change ) Facebook photo You are commenting using your Facebook account. ( Log Out / Change ) Cancel Connecting to %s [ ] Notify me of new comments via email. [ ] Notify me of new posts via email. [Post Comment] [ ] [ ] [ ] [ ] [ ] [ ] [ ] D[ ] This site uses Akismet to reduce spam. Learn how your comment data is processed. Quick Links * Downloads * Mac Troubleshooting Summary * M1 Macs * Mac problem-solving * Painting topics * Painting * Long Reads Search Search for: [ ] [Search] Monthly archives * February 2022 (54) * January 2022 (77) * December 2021 (75) * November 2021 (72) * October 2021 (75) * September 2021 (76) * August 2021 (75) * July 2021 (75) * June 2021 (71) * May 2021 (80) * April 2021 (79) * March 2021 (77) * February 2021 (75) * January 2021 (75) * December 2020 (77) * November 2020 (84) * October 2020 (81) * September 2020 (79) * August 2020 (103) * July 2020 (81) * June 2020 (78) * May 2020 (78) * April 2020 (81) * March 2020 (86) * February 2020 (77) * January 2020 (86) * December 2019 (82) * November 2019 (74) * October 2019 (89) * September 2019 (80) * August 2019 (91) * July 2019 (95) * June 2019 (88) * May 2019 (91) * April 2019 (79) * March 2019 (78) * February 2019 (71) * January 2019 (69) * December 2018 (79) * November 2018 (71) * October 2018 (78) * September 2018 (76) * August 2018 (78) * July 2018 (76) * June 2018 (77) * May 2018 (71) * April 2018 (67) * March 2018 (73) * February 2018 (67) * January 2018 (83) * December 2017 (94) * November 2017 (73) * October 2017 (86) * September 2017 (92) * August 2017 (69) * July 2017 (81) * June 2017 (76) * May 2017 (90) * April 2017 (76) * March 2017 (79) * February 2017 (65) * January 2017 (76) * December 2016 (75) * November 2016 (68) * October 2016 (76) * September 2016 (78) * August 2016 (70) * July 2016 (74) * June 2016 (66) * May 2016 (71) * April 2016 (67) * March 2016 (71) * February 2016 (68) * January 2016 (90) * December 2015 (96) * November 2015 (103) * October 2015 (119) * September 2015 (115) * August 2015 (117) * July 2015 (117) * June 2015 (105) * May 2015 (111) * April 2015 (119) * March 2015 (69) * February 2015 (54) * January 2015 (39) Tags Adobe APFS Apple AppleScript Apple silicon App Store backup Big Sur Blake bug bugs Catalina Consolation Console diagnosis Disk Utility Dore El Capitan extended attributes Finder firmware Gatekeeper Gerome HFS+ High Sierra history history of painting iCloud Impressionism iOS landscape LockRattler log logs M1 Mac Mac history macOS macOS 10.12 macOS 10.13 macOS 10.14 macOS 10.15 macOS 11 macOS 12 malware Metamorphoses Mojave Monet Monterey Moreau MRT myth narrative OS X Ovid painting Pissarro Poussin privacy realism riddle Rubens Sargent scripting security Sierra Swift symbolism Time Machine Turner update upgrade xattr Xcode XProtect Statistics * 11,076,853 hits Blog at WordPress.com. Footer navigation * About & Contact * Macs * Painting * Language * Tech * Life * General * Downloads * Mac problem-solving * Extended attributes (xattrs) * Painting topics * Hieronymus Bosch * English language * LockRattler: 10.12 Sierra * LockRattler: 10.13 High Sierra * LockRattler: 10.11 El Capitan * Updates: El Capitan * Updates: Sierra, High Sierra, Mojave, Catalina, Big Sur * LockRattler: 10.14 Mojave * SilentKnight, silnite, LockRattler, SystHist & Scrub * DelightEd & Podofyllin * xattred, Metamer, Sandstrip & xattr tools * 32-bitCheck & ArchiChect * T2M2, Ulbow, Consolation and log utilities * Cirrus & Bailiff * Taccy, Signet, Precize, Alifix, UTIutility, Sparsity, alisma * Revisionist & DeepTools * Text Utilities: Nalaprop, Dystextia and others * PDF * Keychains & Permissions * LockRattler: 10.15 Catalina * Updates * Spundle, Cormorant, Stibium, Dintch, Fintch and cintch * Long Reads * LockRattler: 11.0 Big Sur * Mac Troubleshooting Summary * M1 Macs * Mints: a multifunction utility * LockRattler: 12.x Monterey Secondary navigation * Search Post navigation Don Quixote 46: Attacked by night Art and Science: 11 New paint Search for: [ ] [Search] Begin typing your search above and press return to search. Press Esc to cancel. * Follow Following + [croppe] The Eclectic Light Company Join 5,396 other followers [ ] Sign me up + Already have a WordPress.com account? Log in now. * + [croppe] The Eclectic Light Company + Customize + Follow Following + Sign up + Log in + Copy shortlink + Report this content + View post in Reader + Manage subscriptions + Collapse this bar Send to Email Address [ ] Your Name [ ] Your Email Address [ ] [ ] loading [Send Email] Cancel Post was not sent - check your email addresses! Email check failed, please try again Sorry, your blog cannot share posts by email. %d bloggers like this: [b]