32GB Memory and Swap Used

MacDaddyPanda

macrumors regular
Original poster
Dec 28, 2018
179
230
USA, CA
Can someone explain why the swap is used despite my having 32GB of Memory? Nothing wrong happens otherwise. I'm just curious if someone can tell me why? Screen Shot 2019-01-17 at 21.24.55.png
 

philipma1957

macrumors 603
Apr 13, 2010
6,309
212
Howell, New Jersey
So it is small swap. Does it grow with time? How much time did it take to get to that number?

I would worry more if I saw page outs and they grew. Although I am not sure it shows page outs anymore.
 

MacDaddyPanda

macrumors regular
Original poster
Dec 28, 2018
179
230
USA, CA
I haven't seen it grow. Previously it was a smaller swap, but I rebooted since and today I saw it at 60mb. I'm not sure when it took place. I've seen my Ram usage go up to 23GB. That happens if I start using google maps or viewing photos or something graphics intensive. Then when I close the photo viewer or the maps tab the ram will drop back down to 20GB or so. If I reboot it goes to 7-8GB. Then as I leave Chrome windows and tabs open It slowly goes back towards 20GB and stays there usually. Typically I'm just surfing the net or watching Youtube at the same time. Occasionally open photo viewer and few other apps that aren't really GPU intensive. Nothing heavy beyond that. I"m not editing 4K vids or photos or anything like that. So I was surprised to see any swap happening at all.
 

nampramos

macrumors 6502
Dec 14, 2010
444
31
I have only 8GB RAM and my of 9GB SWAP, 7-8GB of it is normally in use, even when there's free RAM. I do always have heaps of tabs open (21 right now) on Safari and LightRoom running, plus Spotify and WhatsApp.
 

keysofanxiety

macrumors G3
Nov 23, 2011
9,536
25,262
Some critical system apps or functions also page to disk to improve stability IIRC. Same happens for me. It’s normally just a very small swap file.
 

macdos

macrumors 6502
Oct 15, 2017
310
455
Can someone explain why the swap is used despite my having 32GB of Memory? Nothing wrong happens otherwise. I'm just curious if someone can tell me why? View attachment 816289
Sure, thanks for asking.

It is because Mac OS does not purge cached files before starting to swap to disk, as would be expected (and as is done on Linux). It will just hold on to that cache for as long as it can, even if it is totally useless.
 

dia3olik

macrumors member
Sep 14, 2007
87
18
Italy
Sure, thanks for asking.

It is because Mac OS does not purge cached files before starting to swap to disk, as would be expected (and as is done on Linux). It will just hold on to that cache for as long as it can, even if it is totally useless.
wait a sec...what?? Is there a way to prevent this? thanks!!!
 

macdos

macrumors 6502
Oct 15, 2017
310
455
I tried that, it didn’t seem to do anything when I typed the command. So is this behavior intended? The swapping despite having plenty of memory?
It will clear all cache from memory. The swap remains however, and so do compressed files in memory.

Who knows what Apple intends? The thing is that it will slow down your computer as soon as it starts to use disk instead of RAM, no matter how fast the disk is.
 
  • Like
Reactions: AE_stc

macdos

macrumors 6502
Oct 15, 2017
310
455
It's not your job to manage memory. The operating system does that. None of us truly know how exactly it works, nor do we need to. We also don't need to be concerned about it.
Well, you should be concerned when your computer suddenly becomes very slow… that is when it starts using the disk instead of RAM. No other OS behaves like this.
 
  • Like
Reactions: Cheapassmac

Fishrrman

macrumors Core
Feb 20, 2009
19,652
6,845
If you have 32gb of installed RAM, and you don't "push things to the limit", you could TURN OFF VM disk swapping. NO VM "page ins" or "page outs" at all.

I've done that on a 2012 Mini with only 10gb of RAM.
It runs fine and never crashes.
 

pl1984

Suspended
Oct 31, 2017
2,230
2,642
Well, you should be concerned when your computer suddenly becomes very slow… that is when it starts using the disk instead of RAM. No other OS behaves like this.
Chabig is correct, don't mess with it unless you know exactly what you are doing. Paging is a normal part of an operating systems functionality and some paging, regardless of memory configuration, is not surprising. 60.3 megabytes of paging activity is nothing to be concerned with.
 

MacDaddyPanda

macrumors regular
Original poster
Dec 28, 2018
179
230
USA, CA
Chabig is correct, don't mess with it unless you know exactly what you are doing. Paging is a normal part of an operating systems functionality and some paging, regardless of memory configuration, is not surprising. 60.3 megabytes of paging activity is nothing to be concerned with.
Ok thanks for the info everyone. Yeah I wasn't really wanting to mess with memory management since nothing adverse was happening during my computer usage. Further reading I see this is normal behavior for MacOS and I shouldn't be too concerned. I'm coming from Windows. I thought I understood that Swap was only used when physical memory ran low enough to trigger swap. So with 32GB it was surprising. Since the GPU shares the system memory and it allocates specific amount of memory for that purpose is what I'm seeing a result of GPU causing the memory swap?
I guess on my windows system I never noticed it because I had a dedicated gaming video card. So any swapping on Windows would be unusual barring me using a photoshop type app or some heavy application like cad or something?
 

pl1984

Suspended
Oct 31, 2017
2,230
2,642
"some paging" is not normal if you have enough RAM.

screenshot is with running logic. when i quit logic, cached files dropped for 0.5gb
Yes, it is. From my 2010 Mac Pro:

Screen Shot 2019-01-18 at 9.48.03 AM.png


Unless you have intimate details of how macOS manages its memory don't worry about a few megabytes worth of paging.
 

NT1440

macrumors G5
May 18, 2008
12,323
15,396
Well, you should be concerned when your computer suddenly becomes very slow… that is when it starts using the disk instead of RAM. No other OS behaves like this.
Well yea, IF it becomes very slow. The OP has made no mention of that, at all, so why bring it up when it's clearly not happening?
 
  • Like
Reactions: chabig

MacDaddyPanda

macrumors regular
Original poster
Dec 28, 2018
179
230
USA, CA
mine never pages unless it runs out of physical RAM.
In your screenshot I suspect you ran out of RAM at some point or were nearing that moment
Yeah it must have, but I'm not 100% sure. As I never saw it reach 30GB or something. Unless the threshold for swapping is lower.
 
  • Like
Reactions: Cheapassmac

pl1984

Suspended
Oct 31, 2017
2,230
2,642
Yeah it must have, but I'm not 100% sure. As I never saw it reach 30GB or something. Unless the threshold for swapping is lower.
Paging is common during operating system operation (Windows too) and it is therefore the answer to the question. If you want specifics a much more in depth analysis would be required. An analysis which it's unlikely would ever be possible.
 
  • Like
Reactions: tagumcity

FrontierForever

macrumors newbie
Nov 10, 2018
25
19
It's not your job to manage memory. The operating system does that. None of us truly know how exactly it works, nor do we need to. We also don't need to be concerned about it.
As an AAPL shareholder, bricking customer's computers sooner can only increase sales. Need to keep the investors happy.
 
  • Like
Reactions: Cheapassmac

Cheapassmac

macrumors regular
Nov 5, 2018
210
139
mine never pages unless it runs out of physical RAM.
In your screenshot I suspect you ran out of RAM at some point or were nearing that moment
I've seen a couple MB of paging even when clearly having enough memory and literally idling. I suspect there's room for improvement in the OS as it shouldn't have paged in theory (but did).

Luckily, a couple megabytes of paging over a long period of time in a system swimming in gigabytes, it's small enough to not matter too much (in respect to performance and SSD wear and tear).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.