1

I am trying to understand why my almost factory settings 13-inch MacBook Air 2017 with 8GB RAM available takes 2.3GB to just boot. The result is that if I start having Chrome+Dropbox+something to write any document, the machine starts swapping up to 2GB of stuff, and I really hate it, because the hard drive is indeed SSD.

  1. How do I manage Agents and Daemons on a MacBook? I am used to just open a whatever program that has the full list of services and tick them to enable or disable.
  2. How come does macOS waste so much RAM?

I come from Debian, so basically this sort of wall I perceive between me and the core settings of my machine is horribly frustrating. Thank you.

EDIT: first of all, I updated from Mojave to Catalina, to see if things improved. Following suggestions in the comments, I decided to add some screenshots of the activity monitor in different conditions:

plain boot memory usage adding dropbox app to the boot opening chrome with youtube+gmail+newspaper+overleaf tabs adding two pdf's on Preview app

the four screenshots represent:

  1. the activity monitor right after a very plain boot (basically just the OS in I think almost factory condition)
  2. after Dropbox app started
  3. after I also opened Chrome with four tabs, and
  4. Preview with two pdf's.

The pictures speak by themselves. I even tried to sum up the memory usage of Chrome and its child processes, and never goes beyond some 700MB. Most likely it also allocates something in the kernel space, and the wired memory takes 200MB more.

At now, it still did not start swapping, but I figured out that for some reason it places lots of stuff in the cache, and dropbox and chrome waste an incredible amount of memory for absolutely no reason (Dropbox is literally empty right now).

10
  • 1
    How do you measure the amount of RAM used just to boot? - I have a suspicion that you might be interpreting some numbers incorrectly, leading you to think it is using more memory than it actually is.
    – jksoegaard
    Commented Oct 9, 2020 at 12:14
  • 1
    And just as a side note. Apple computers were conceived as "computers for the rest of us." A computer where you didn't have to manage esoteric core settings for the computer to perform. So macOS hides, obfuscates and in some cases makes impossible to access these kinds of settings that you are accustomed to (and possibly love to) tweak. Though macOS is based on a microkernal BSD Unix it has been tweaked and modified to an almost unrecognizable extent. So expecting it to behave like any Linux distro is unrealistic. THAT is were the fun lies, discovering those differences. Commented Oct 9, 2020 at 13:16
  • 5
    Swapping out 2 Gb is a problem: using 2.5Gb of RAM at startup is not. MacOS is designed to use as much RAM as possible, not to be frugal with it.
    – benwiggy
    Commented Oct 9, 2020 at 14:25
  • 2
    @marco Where in Activity Monitor exactly? - Please include a screenshot. I sounds very much like you're misinterpreting the stats. The computer is supposed to use as much RAM as possible - this is how macOS, Windows, Linux and many other operating systems work. The RAM is used to cache data read from disk. This is a really good thing, not a bad thing. Swapping on the other hand is not good, so you rather want to focus on solving that.
    – jksoegaard
    Commented Oct 9, 2020 at 19:52
  • 1
    Hello, thank you for your comments. It took me a while to have time for answering, but today I took few screenshots. If I am not misinterpreting what I see, it is true that Chrome is really a memory hog, I guess the problem does not happen at boot, even if a simple boot sequence will take 3.6GB of app+wired memory+cached files, for absolutely no reason I think ..
    – marco
    Commented Oct 11, 2020 at 20:02

2 Answers 2

2

Contrary to what you might think - macOS is actually not wasting RAM in this case.

As I see in your comments, you seem to be using an equation like this:

used ram = app memory + wired + cached

and you're using the term "used ram" as if it means "spent ram" or something like that.

That's actually not the case.

If you want to look at "spent ram" (i.e. RAM used for something that cannot currently be used for something else) you should not include the cached RAM in the equation!

What you really want to have happen is for as much RAM as possible to be used as cache RAM. It will potentially speed up future data requests as they could potentially be fulfilled from cached instead of from the much slower disk - all while not taking up any valuable resource at all, because as soon as that RAM is needed for something else, the operating system will just use it for that something else.

The other part of your question is wanting to manage launch agents and daemons in order to be able to enable/disable them according to your needs from a big list. You can do this with the tool LaunchControl available from here:

https://www.soma-zone.com/LaunchControl/

1
  • 1
    A+ recommendation on Launch Control and soma zone. Spot on for the rest of the analysis.
    – bmike
    Commented Oct 11, 2020 at 20:25
2

Memory is meant to be used fully then, only later once you have a “problem” does the OS optimize and compress based on pressure. Everything looks excellent, as designed and well in order in your examples. Even if you have some memory swapped, that’s no performance issue in practice. Only after excessive swapping and sustained memory pressure would any any slowdown be measurable or need for remediation on macOS that have the pressure graph prominently featured in Activity Monitor.

The only problem (if you can call it that) is taking older articles at face value and assuming this is not correct behavior. That problem is actually an opportunity to learn how the system is designed and what signals to pay attention to now when you are tuning for performance.

Here are some excellent places to get started on why Apple’s unix operating systems are not like others. Consider how many active hours of running OS Apple has with watchOS, tvOS, iOS, iPadOS, and macOS all running the same kernel, same scheduler, and most 24x7 and need no active tuning or management under very strict RAM budgets.

4
  • Let’s see if I need a bigger edit to this to reference any Apple KB if needed. OP clearly knows a lot about VM on other OS so this is a great question IMO. Clear and well documented reasoning.
    – bmike
    Commented Oct 11, 2020 at 20:27
  • 1
    I don't understand why you say that Apple's operating system is not like others... the way this functions is exactly the same on any other major operating system. Apple's virtual memory system is even slightly outdated compared to Windows/Linux, so it's not like this is something that Apple does markedly better than others.
    – jksoegaard
    Commented Oct 11, 2020 at 20:41
  • Fair criticism, @jksoegaard I need to think on that. Perhaps it’s more about the ecosystem / API / SDK and less that the kernel and pager run without needing tweaks on memory constrained devices. Maybe I should focus that our actions should be different with Apple OS rather than say the base is different.
    – bmike
    Commented Oct 11, 2020 at 20:45
  • I don't see how our actions should be different here (?) - running ordinary applications and having their memory managed is really no different on macOS than on Windows or Linux. The API/SDK for the kernel pager is definitely not nicer on macOS than other systems. As for memory constrained devices, I guess it's a matter of definition... this and the previous generation Apple Watch has 1 GB of RAM, the AppleTV has 2/3 GB depending on model, the iPhone has 3/4 GB depending on model, etc. It that really memory constrained? Considering that you can run the latest Linux kernel on 16 MB RAM or less.
    – jksoegaard
    Commented Oct 12, 2020 at 8:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .