Am I out of RAM on my MBP M1 Pro?

Overall, very pleased so far with my MBP M1 Pro (16GB/1TB), but every now and then it seems a little sluggish. I’ve even looked at returning it for a 32GB model, but it isn’t even in the Apple Trade In program yet. OTOH, maybe I just don’t understand how it manages memory. For example, the graphic below is typical of “normal state” operations. To my layman’s eye, I’m thinking it’s always starved for RAM with only about 10% headroom. As an experiment, about in the middle of the “Memory Pressure” histogram shown, I quit Xcode, which was using 7.5GB. It appeared to make no difference! So I’m confused, am I out of RAM or not?

The presence of 8 GB (50% of your physical memory) worth of swap tells me that you might need more RAM.

Note, however, that the small amount of “free” memory is misleading.

Any good modern operating system will find something useful to do with memory that apps don’t need - like caching file system data or keeping commonly used system frameworks in memory so apps don’t need to load them later. This memory usage can typically be discarded on short notice, should an application require it later one.

As for what happened when you quit Xcode, this isn’t surprising either. On most modern operating systems, when you quit an application, the memory used for its data storage will be freed back to the system, but the memory used by the application’s code and shared libraries won’t be. Libraries shared with other apps (e.g. system frameworks) will remain in memory because other apps are using them. Code that isn’t used by anybody else will be retained in case it is needed later (e.g. if you re-launch the same app). That memory can be discarded if needed to make more free memory for running apps.

With respect to swap space, it will typically not be used unless you really have overcommitted memory. But used swap space doesn’t necessarily mean that there is a current problem. Only that memory has been overcommitted since your last reboot.

When apps terminate or otherwise free memory, the OS doesn’t automatically move the swapped-out memory back into RAM. It will leave that memory in the swap file until it is actually needed, which might not happen for a long time if the swapped-out memory isn’t used very much. Which will typically be the case - good operating systems make a point of swapping out memory that they believe will be least likely to be needed, in order to minimize the amount of swapping activity.

In order words, it isn’t easy to understand what’s going on by simply looking at statistics like the memory pressure histogram. There’s way too much complicated activity taking place under the covers and statistics can only show you some aggregate data.

6 Likes

Thanks for that great primer on memory management, David. I’ll keep an eye on the Swap number, making note of what it looks like after a reboot, and what it looks like when I think the machine is “sluggish.” If only I could upgrade the RAM in this thing. If I have to trade it in and buy new, that’s going to be an expensive 16GB!

I think that panel is telling you pretty much all you need to know. Memory pressure is high and swap is high too. You want to see perhaps 1-10% of your RAM as swap, definitely 50% is too high. So your system has at least since the last boot had to allocate more memory than physically available and when that happens people sometimes note sluggish behavior. This has gotten a lot better with high-BW busses to ultrafast disks and especially with the level of integration Apple has achieved in M1 systems (an M1 Pro can push over 5 GB/s to/from its SSD), but it’s still slow compared to direct access to RAM.

If you encounter such sluggishness again and you note it’s again because your Mac is paging out to swap (high mem pressure), you will want to exchange your Mac for a model with more RAM. The downside to this high level of integration is that you can’t add RAM later on like we used to by just adding/swapping DIMMs. You’re stuck with what you configured at purchase. I sometimes wonder if we’ll eventually see some effect of this as Mac resale values depress due to increased supply.

2 Likes

So to follow up on @Shamino’s and @Simon’s excellent explanations of How Things Work, I had the following results from my experimentation:

#1: Reboot, no apps running (but several “at-launch” background tasks were)

#2: Launched all my usual apps

#3: Opened an Xcode project (SwiftUI with Canvas preview) plus ran an app on the Simulator

My conclusion: Xcode is a memory hog! I mean, not in a bad way, but it just is. So, I can either run all my other apps or Xcode (but not both), or I can buy a new machine (three months…a new record!). At the moment, prudence (and ensuring domestic tranquility) is leaning hard toward option 1.

1 Like

The resale value of a 10-core M1 Pro 16/1TB is presently just slightly above $1k. You’re going to take quite a hit so if you can work around the issue it’s likely best to try that. Unless of course this is for serious work and then I guess that’s just the cost of doing business.

I think you’ve nailed it. Xcode is a very big application.

How many of your usual apps must be kept running at all times? The time it takes to re-launch an app is pretty fast, so maybe it would work better to shift into a habit where you don’t leave everything running, but quit apps when you’re done with them and re-launch when you need them again. (The dock and/or Launchpad is really good for this).

FWIW, I don’t leave much of anything running that I’m not actively using. My web browser is open most of the day, because I use it all day, but nearly everything else is launched and quit on an as-needed basis. (I have toolbar icons in my web browser that let me know when I receive new mail - at which point I either launch my mail app or go to the mailbox’s web page.)

On my work computer, I need to leave a bit more open (Outlook, for e-mail and the corporate calendar. MS Teams so I can be contacted by the people I work with), but still only what I actually need to have running.

And at the end of the day, when I’m done using the computer, I log-out. Which makes sure that everything quits. So I can start fresh the next day. (I rarely see a need to shutdown/reboot, except when software updates demand it.)

2 Likes

I’m curious about resale values.
What sites did you use to come up with that estimate?

There are various resale sites as well as Ebay of course. I prefer sticking with a site I know from past experience runs a serious business. SellYourMac will give you a quote for any Mac you spec.

I hadn’t found Sell Your Mac.
Interesting that the base model has lost that much value so rapidly.

Indeed. It’s especially noteworthy because we keep seeing reports about how Apple is apparently having trouble to maintain supply of these new MBPs. You’d think that that would, if anything, buoy up resale value of barely use Macs of this latest generation.

I will say though that my wife’s work just ordered her a new 14" MBP (base config with some added SSD capacity, nothing fancy) and was initially quoted 2-3 weeks by Apple, however, less than a week later her new MBP sipped from a SoCal warehouse. That to me does not exactly sound like supply problems (but of course n=1 is no statistic either).