Why does RAM get used up more than CPU?

Hieveryone

macrumors 601
Original poster
Apr 11, 2014
4,157
1,476
USA
I'm using a 2019 15" base MacBook Pro with 6-cores and is 2.6/16/256

I usually run 2 live stream shows at the same time on Chrome, while browsing the web on Firefox and Safari.

I've noticed in activity monitor RAM is used at about 10GB+ and a quite a bit cached as well, while my CPU is like 90% idle.

Why is this, and generally what stresses the CPU?
___________________________________________

EDIT: I've got a 3rd process going that's live, not a show, just updates in real time.

Now my RAM is 13GB used with a bunch of cached RAM, but still just under 90% CPU idle BUT when I immediately look at activity monitor it's around 75% idle. If I just watch it with no acitivity then it jumps to around 90% idle
 
Last edited:

New_Mac_Smell

macrumors 68000
Oct 17, 2016
1,914
1,491
Shanghai
CPU calculates things, then stores the 'working out' section in the RAM. So the RAM is like a little storage area for the CPU.

It does this so it can quickly get those parts it's already calculated, as and when it needs them. As long as it has RAM, it will put stuff in there it might need. This is to speed everything up, rather than recalculating things over and over.

Once the RAM is full, or it has calculations that aren't needed that much, it puts them into a cache. There's levels of this system (It's a bit more complicated), in which the access time gets slower. CPU > RAM > SSD.

This is why your CPU isn't being stressed, you're probably barely touching it - running a few web browsers isn't taxing work for the CPU, and it would be a waste of resources to dump everything onto the CPU. So to save power, speed things up etc. it uses the RAM as much as possible.

Side note, never look at the actual RAM usage in Activity Monitor, it just tells you that things are optimised (I.E. using as much RAM as possible). Always looking at the memory pressure chart, as long as this is green then things are good.
 

applesed

macrumors regular
Jun 25, 2012
105
54
If you’re running java programs, it will take up as much memory as is available, to delay garbage collection as long as possible. One way to limit this is max heap size. But again, that’s specifically java.
 

jerryk

macrumors 601
Nov 3, 2011
4,864
2,405
SF Bay Area
RAM is memory. Read in a big spreadsheet and hold it in memory and it eats up RAM. CPU is the cycles that would process that data you just read i. Just sit there and stare at the data and few CPU cycles are used.
If you’re running java programs, it will take up as much memory as is available, to delay garbage collection as long as possible. One way to limit this is max heap size. But again, that’s specifically java.
Not really specific to Java. A lot of memory models are based on on-demand/need garbage collection (i.e. reallocating memory). Garbage collection eats CPU cycles, no used doing it until there is a demand for the memory.
 

Hieveryone

macrumors 601
Original poster
Apr 11, 2014
4,157
1,476
USA
Ok I think I understand a little better.

I’ve been more interested in learning about my machine.

I know it’s very capable and want to make the most out of it.

I’m looking to get into music production and I think with a little basic compute rknowledge I’ll be able to really appreciate its capabilities.

These 8 core laptops with 32gb ram are amazing, but I only this from YouTube reviews and what others say. I feel like I can’t appreciate it and know what all it can do simply bc I don’t have much knowledge of how it all works.
 

Glockworkorange

macrumors 68010
Feb 10, 2015
2,004
3,194
Chicago, Illinois
I'm using a 2019 15" base MacBook Pro with 6-cores and is 2.6/16/256

I usually run 2 live stream shows at the same time on Chrome, while browsing the web on Firefox and Safari.

I've noticed in activity monitor RAM is used at about 10GB+ and a quite a bit cached as well, while my CPU is like 90% idle.

Why is this, and generally what stresses the CPU?
___________________________________________

EDIT: I've got a 3rd process going that's live, not a show, just updates in real time.

Now my RAM is 13GB used with a bunch of cached RAM, but still just under 90% CPU idle BUT when I immediately look at activity monitor it's around 75% idle. If I just watch it with no acitivity then it jumps to around 90% idle
Starting with Mavericks (I think), Apple implemented a protocol to put all the RAM to use, even if not really needed.
 

currahee2100

macrumors regular
Feb 9, 2009
172
39
CPUs only work when computational processing is needed. It’s a whole beast in and of itself, from instruction pipelining, caching, branch prediction, etc. every button you click, every time you use your mouse, all those actions are recorded by the processor. But when nothing is there, it doesn’t do anything. It’s like chefs in a restaurant. You don’t cook food unless there are orders!

Most modern intel CPUs have built in video cards which leads us to....

Those video cards handle most of the decoding when it comes to playing videos. So you can run your streams and it barely taxes the processor. Windows 10 does a better job at this- you can see the task manager and see how much the gpu usage is.

As for RAM, you can think of it as like a desk at work. You’ll read a book, find you need another one and set it on the desk. Now you have both- old one you were referring to still there. When you’re done you put some or all of them back (like shutting down a computer or closing a program).

Modern operating systems start loading data from programs and hold them in memory so that programs you often load will load faster. That’s why RAM usage these days isn’t a big indicator of actual usage. But macOS and Windows tells you at what is actually being used and what is a cache for applications.
 

Glockworkorange

macrumors 68010
Feb 10, 2015
2,004
3,194
Chicago, Illinois
I’m guessing that’s a good thing
Sure. If you had a system with 8 gig's and checked the RAM usage, RAM would just sit there unused. Now the system takes advantage of it.

I was commenting because I've seen some people think they don't have enough RAM because they see macOS is using all of it---that's not necessarily correct, not anymore, anyway.
 
  • Like
Reactions: Howard2k

MrGunnyPT

macrumors 6502a
Mar 23, 2017
583
477
Sure. If you had a system with 8 gig's and checked the RAM usage, RAM would just sit there unused. Now the system takes advantage of it.

I was commenting because I've seen some people think they don't have enough RAM because they see macOS is using all of it---that's not necessarily correct, not anymore, anyway.
The best way to see if you need more RAM or not is checking the Memory Pressure.
 
  • Like
Reactions: Howard2k

Hieveryone

macrumors 601
Original poster
Apr 11, 2014
4,157
1,476
USA
I have 16 and I’m pretty sure that’s enough for my usage.

I really don’t feel like I need 32GB RAM.

Heck I don’t even think I need 6 cores.

What I need is fast single core speed like mine is 2.6 GHz which is good for me.

I mainly use basic stuff. Would be nice if I could’ve gotten 2.9 or 3.1 clock speed
 

x-evil-x

macrumors 601
Jul 13, 2008
4,483
2,222
  • Like
Reactions: Painter2002

Painter2002

macrumors 65816
May 9, 2017
1,074
755
Austin, TX
I have 16 and I’m pretty sure that’s enough for my usage.

I really don’t feel like I need 32GB RAM.

Heck I don’t even think I need 6 cores.

What I need is fast single core speed like mine is 2.6 GHz which is good for me.

I mainly use basic stuff. Would be nice if I could’ve gotten 2.9 or 3.1 clock speed
16gb RAM is adequate for most tasks, even on my custom AMD rig I rarely pass 10gigs of RAM even on intensive tasks (and AMD chips are VERY ram hungry). 32 go RAM is going to be for those who know they need it, like running multiple VMs.

As for CPU cores I can say that six cores is nice. If you are using multiple apps at once it does come in handy. It really all depends on what you need, and how patient you are ok waiting for tasks to compute on your machine.
[doublepost=1561154633][/doublepost]
This is a good point not many mainstream users simply do not know or understand.

Higher clock speeds most certainly does not equate to better performance, but manufacturers sure do love advertising it that it does.
 

bunnspecial

macrumors 604
May 3, 2014
6,722
3,275
Kentucky
Starting with Mavericks (I think), Apple implemented a protocol to put all the RAM to use, even if not really needed.
I should know this for sure since I have a fairly high spec(12 core, 32gb RAM) system that runs SL as its primary OS(legacy applications), but AFAIK all versions of OS X have pretty much expanded to fill available RAM given enough time to do so and put it to use.

This was not the case in the "classic" OS. I have computers like a PowerMac 9600 that have a ludicrous amount of RAM given their other specs(1.5gb in the 9600-12x 128mb modules) and I've never even come close to filling up the RAM on them. I can do it in OS 9 on something like a G4 where I might be handling big image files(film scans) in the scanner software or Photoshop, but the 9600 is too slow in other area to reasonably consider it.

In any case, from what I know of *nix OSs(most of my experience with them is OS X/macOS, but I also have some experience with IRIX and a bit with Solaris), the general philosophy is "unused RAM is wasted RAM" and "find something to do with anything not actively in use." This was a bit jarring when I switched from Windows 7 to OS X 10.7(the current versions of each when I made the switch) but ultimately I came to appreciate it. Back in the 10.7 days, I would look at my page in/page out ratio, and specifically the number of page outs, to see if I needed more RAM. My first Mac, a late 2011 13", shipped with 4gb, and I would routinely see about as many page outs as page ins. I upped it to 8gb, and for a while I'd see a few thousand page outs for every million page ins, although this crept up over time. Now on a 2012 MBP with 16gb of RAM, I'm currently at 45K outs for 7.3 million ins-still not a ratio that concerns me too much.

10.9(Mavericks), though, did do a few things with memory handling that were ultimately for the better, although initially I was resistant to them(as I think were a lot of people). On the handling side, it introduced memory compression, which is a concept I admit to still not fully grasping, although it's there and works. The bigger change for the end user, though, was replacing the pie chart of memory usage with the "memory pressure" graph. I think for the average user, and even the moderately technically minded one, it's not abundantly clear what the different between, for example "active" and "wired" memory is, and how "inactive" memory differs from "free" memory. BTW, on my MBP that I'm typing this from, only 24mb out of 16gb is claimed as "free" although it also only claims 7.92gb as "used" leaving over 8gb that the OS is apparently using in some capacity(3gb is claimed as swap, for example).

In general, I don't like Apple seemingly "dumbing down" features in the OS, but given how complicated memory management actually is in OS X I think that memory pressure is actually quite a useful indicator. Basically, as long as it stays green, you're fine. Occasionally flirting with yellow is fine too, although back in the fondly remembered days of user upgradeable RAM on most of the line up, frequent trips into yellow meant that you should be shopping for a RAM upgrade. When it hits red, you can either figure out what's eating up your RAM and kill it, or just let whatever it is finish what it's doing.

I've only routinely seen pressures in red on computers with 2gb of RAM. Most notable among these is the 2009 MBA, which of course is stuck there. I recall installing the Sierra Beta on a recently acquired unibody(white) MacBook which-at the time-still had the 2gb of RAM it came with from the factory. I visited the Apple store a day or two after installing to try and get a replacement rubber bottom(I'd apparently missed the cut-off on free replacements by a few months). The Genius who waited on me hadn't played with Sierra yet when I brought it in, and I told him he was welcome to try, but we both agreed that first beta with 2gb of RAM was unusable.
 
  • Like
Reactions: Glockworkorange

cynics

macrumors G4
Jan 8, 2012
11,313
1,696
I'm using a 2019 15" base MacBook Pro with 6-cores and is 2.6/16/256

I usually run 2 live stream shows at the same time on Chrome, while browsing the web on Firefox and Safari.

I've noticed in activity monitor RAM is used at about 10GB+ and a quite a bit cached as well, while my CPU is like 90% idle.

Why is this, and generally what stresses the CPU?
___________________________________________

EDIT: I've got a 3rd process going that's live, not a show, just updates in real time.

Now my RAM is 13GB used with a bunch of cached RAM, but still just under 90% CPU idle BUT when I immediately look at activity monitor it's around 75% idle. If I just watch it with no acitivity then it jumps to around 90% idle
RAM is a place to store data for the CPU due its speed relative to SSD/HDD. This is because of the RAM fast physical connection to the CPU and how data is stored on it and overwritten.

At a very basic level once data is loaded into RAM it stays there (cached) until the RAM is needed by another process.

Depending on your usage determines on how much RAM will be used, cached, compressed or moved to swap. Live streaming for example produces and processes data that is only limited to the quality and duration of the stream. RAM is filled up very quick, compressed and swap may be used as well trying to accommodate the data. That doesn't mean more RAM would help because that would just cause it to initial fill up slower. Swap usage is virtually memory which is the SSD/HDD pretending to be a RAM to accommodate your data. Its the last thing used because it very slow compared to RAM.

However its usage doesn't indicate a problem nor does it indicate you'll have poor performance. Its much more complex then that which is why Apple implemented a memory pressure graph in Activity Monitor. If its always green (regardless of height) you'll be very hard pressed to notice or feel any degradation in performance what so ever when it comes to memory usage. Matter of fact when it comes to swap usage you can have MORE swap used with BETTER performance depending variables that are overlooked by the average user that MacOS memory pressure can highlight.

This is the best I can do but if I load a 4k HEVC (very complex encode) 10bit 60fps video in DaVinci Resolve w/ proxy off using my 2018 MB Pro w/ TB w/ 4 core i5, integrated graphics w/ 8gb of RAM than start scrubbing back and forth on playback I can get memory pressure to do this. Note the swap usage.

Screen Shot 2019-07-04 at 4.43.41 AM.png


This is a couple minutes after I stopped randomly scrubbing back and forth in the video. Again note the swap usage.

Screen Shot 2019-07-04 at 4.51.12 AM.png


Performance in that test was terrible (keep in mind I have to make a video intentionally designed to cause an issue) however not because of the memory but because of the CPU and iGPU (or more accurately, lack of dedicated GPU). Using a realistic video like a 4k h264 8bit 30fps clip shot from an iPhone 6S has virtually no effect on the memory pressure as it stays green and while performance is better the CPU is still the bottleneck causing a lot of dropped frames.

I bought refurb and I knew my usage for the machine and when I had the option between 16gb OR 512gb SSD I went with the SSD since for with my usage more RAM would do very little for me combined with that 2.3ghz i5.

TLDR: Memory pressure in Activity Monitor will tell you whether you will benefit from more RAM or if there is any issue at all. Unless you have a very firm understanding of how MacOS's memory management works everything else can be ignored. Memory used, compressed, cached and swap use with no context are irrelevant if performance is goal. Depending on your usage, goals, expendable cash and emotions more RAM (or maxed out) could benefit you. For example someone running VM's and heavy multitasking (not 10 safari tabs but actual memory heavy processes) may benefit from more RAM on a slower CPU with iGPU. If you just have an arbitrary goal to not use swap regardless of performance or other measurable metrics. Or if it just gives you peace of mind.....go for it. Not knocking how anyone spends the money they earned here...
 

Glockworkorange

macrumors 68010
Feb 10, 2015
2,004
3,194
Chicago, Illinois
I should know this for sure since I have a fairly high spec(12 core, 32gb RAM) system that runs SL as its primary OS(legacy applications), but AFAIK all versions of OS X have pretty much expanded to fill available RAM given enough time to do so and put it to use.

This was not the case in the "classic" OS. I have computers like a PowerMac 9600 that have a ludicrous amount of RAM given their other specs(1.5gb in the 9600-12x 128mb modules) and I've never even come close to filling up the RAM on them. I can do it in OS 9 on something like a G4 where I might be handling big image files(film scans) in the scanner software or Photoshop, but the 9600 is too slow in other area to reasonably consider it.

In any case, from what I know of *nix OSs(most of my experience with them is OS X/macOS, but I also have some experience with IRIX and a bit with Solaris), the general philosophy is "unused RAM is wasted RAM" and "find something to do with anything not actively in use." This was a bit jarring when I switched from Windows 7 to OS X 10.7(the current versions of each when I made the switch) but ultimately I came to appreciate it. Back in the 10.7 days, I would look at my page in/page out ratio, and specifically the number of page outs, to see if I needed more RAM. My first Mac, a late 2011 13", shipped with 4gb, and I would routinely see about as many page outs as page ins. I upped it to 8gb, and for a while I'd see a few thousand page outs for every million page ins, although this crept up over time. Now on a 2012 MBP with 16gb of RAM, I'm currently at 45K outs for 7.3 million ins-still not a ratio that concerns me too much.

10.9(Mavericks), though, did do a few things with memory handling that were ultimately for the better, although initially I was resistant to them(as I think were a lot of people). On the handling side, it introduced memory compression, which is a concept I admit to still not fully grasping, although it's there and works. The bigger change for the end user, though, was replacing the pie chart of memory usage with the "memory pressure" graph. I think for the average user, and even the moderately technically minded one, it's not abundantly clear what the different between, for example "active" and "wired" memory is, and how "inactive" memory differs from "free" memory. BTW, on my MBP that I'm typing this from, only 24mb out of 16gb is claimed as "free" although it also only claims 7.92gb as "used" leaving over 8gb that the OS is apparently using in some capacity(3gb is claimed as swap, for example).

In general, I don't like Apple seemingly "dumbing down" features in the OS, but given how complicated memory management actually is in OS X I think that memory pressure is actually quite a useful indicator. Basically, as long as it stays green, you're fine. Occasionally flirting with yellow is fine too, although back in the fondly remembered days of user upgradeable RAM on most of the line up, frequent trips into yellow meant that you should be shopping for a RAM upgrade. When it hits red, you can either figure out what's eating up your RAM and kill it, or just let whatever it is finish what it's doing.

I've only routinely seen pressures in red on computers with 2gb of RAM. Most notable among these is the 2009 MBA, which of course is stuck there. I recall installing the Sierra Beta on a recently acquired unibody(white) MacBook which-at the time-still had the 2gb of RAM it came with from the factory. I visited the Apple store a day or two after installing to try and get a replacement rubber bottom(I'd apparently missed the cut-off on free replacements by a few months). The Genius who waited on me hadn't played with Sierra yet when I brought it in, and I told him he was welcome to try, but we both agreed that first beta with 2gb of RAM was unusable.
I guess I ended up being right! Thank you for the deep dive—very informative.
[doublepost=1562245355][/doublepost]
I should know this for sure since I have a fairly high spec(12 core, 32gb RAM) system that runs SL as its primary OS(legacy applications), but AFAIK all versions of OS X have pretty much expanded to fill available RAM given enough time to do so and put it to use.

This was not the case in the "classic" OS. I have computers like a PowerMac 9600 that have a ludicrous amount of RAM given their other specs(1.5gb in the 9600-12x 128mb modules) and I've never even come close to filling up the RAM on them. I can do it in OS 9 on something like a G4 where I might be handling big image files(film scans) in the scanner software or Photoshop, but the 9600 is too slow in other area to reasonably consider it.

In any case, from what I know of *nix OSs(most of my experience with them is OS X/macOS, but I also have some experience with IRIX and a bit with Solaris), the general philosophy is "unused RAM is wasted RAM" and "find something to do with anything not actively in use." This was a bit jarring when I switched from Windows 7 to OS X 10.7(the current versions of each when I made the switch) but ultimately I came to appreciate it. Back in the 10.7 days, I would look at my page in/page out ratio, and specifically the number of page outs, to see if I needed more RAM. My first Mac, a late 2011 13", shipped with 4gb, and I would routinely see about as many page outs as page ins. I upped it to 8gb, and for a while I'd see a few thousand page outs for every million page ins, although this crept up over time. Now on a 2012 MBP with 16gb of RAM, I'm currently at 45K outs for 7.3 million ins-still not a ratio that concerns me too much.

10.9(Mavericks), though, did do a few things with memory handling that were ultimately for the better, although initially I was resistant to them(as I think were a lot of people). On the handling side, it introduced memory compression, which is a concept I admit to still not fully grasping, although it's there and works. The bigger change for the end user, though, was replacing the pie chart of memory usage with the "memory pressure" graph. I think for the average user, and even the moderately technically minded one, it's not abundantly clear what the different between, for example "active" and "wired" memory is, and how "inactive" memory differs from "free" memory. BTW, on my MBP that I'm typing this from, only 24mb out of 16gb is claimed as "free" although it also only claims 7.92gb as "used" leaving over 8gb that the OS is apparently using in some capacity(3gb is claimed as swap, for example).

In general, I don't like Apple seemingly "dumbing down" features in the OS, but given how complicated memory management actually is in OS X I think that memory pressure is actually quite a useful indicator. Basically, as long as it stays green, you're fine. Occasionally flirting with yellow is fine too, although back in the fondly remembered days of user upgradeable RAM on most of the line up, frequent trips into yellow meant that you should be shopping for a RAM upgrade. When it hits red, you can either figure out what's eating up your RAM and kill it, or just let whatever it is finish what it's doing.

I've only routinely seen pressures in red on computers with 2gb of RAM. Most notable among these is the 2009 MBA, which of course is stuck there. I recall installing the Sierra Beta on a recently acquired unibody(white) MacBook which-at the time-still had the 2gb of RAM it came with from the factory. I visited the Apple store a day or two after installing to try and get a replacement rubber bottom(I'd apparently missed the cut-off on free replacements by a few months). The Genius who waited on me hadn't played with Sierra yet when I brought it in, and I told him he was welcome to try, but we both agreed that first beta with 2gb of RAM was unusable.
Question—I have a 16 gb MacBook Pro.

Memory used is 12.28. It’s telling me swap is 9.11. The memory pressure is still green. I thought Swap was a “bad” thing and over half my physical memory is tied up in swap, yet memory pressure is green...?

This is just too complicated and they need to explain this better.