You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Over 3GB of swap files with 16GB of RAM?

Just bought a MBPr with 16gb of RAM (more for futureproofing than any actual need right now). I'm constantly checking Activity Monitor and "Free RAM" is always around 8GB or more. I notice, however, that the "Swap used" totals are quite high. I don't have any pageouts so why do I have so much swapspace being consumed? With an SSD drive in here, should I not be worried that the OS is using swapspace so much when it probalby doesn't need to?


Thanks!

MacBook Pro (Retina, Mid 2012), OS X Mountain Lion

Posted on Jul 31, 2012 6:44 PM

Reply
Question marked as Top-ranking reply

Posted on Aug 2, 2012 4:42 PM

So I loaded up all my big memory users. I upped VBox's VM usage to 2GB to help speed along the process.


I've been checking Activity Monitor regularly and the free mem has not once gone below 8GB (big green part of the pie).


Just now I woke my MacBook from sleep and it hung for about 30 seconds. I checked the /var/vm folder and there are tons of swapfiles that were seemingly just created at that instant.


Wonder what's going on. It's fair to say the last time I used my MacBook there were no swapfiles.


Free memory has always been super high.

User uploaded file

73 replies

Aug 3, 2012 12:47 PM in response to etresoft

I will not say anything here on Apple Support Communities unless I know it is true


OK, let's look at some of your past statements in this thread, shall we?


When asked to backup your claims this was your response:

I have no idea where I saw it specifically. It was probably some developer

documentation


Virtual Memory works today as I had described yet your response was:

That is how virtual memory worked 20 years ago


And my favorite yet, a post full of speculation with you yourself admitting you don't know the real answer and yet off you go spewing misinformation:

They could be backing store of the application such that if it does need to be swapped, the OS doesn't have to worry about writing it. I don't know the real answer.


Look, my issue was asking whether it was normal to have such swap usage on a light workload. And yes, I have a light workload. The fact that I had a corrupt font causing fontworker process to consume tons of RAM does not make my workload any heavier. The answer is, no it's not normal but you offerred no help. I found it on my own and had some great suggestions from other posters in this thread who actually focused on my question rather than trying to tell the world how smart they thought they were.

Aug 3, 2012 12:59 PM in response to megagram

megagram wrote:


you offerred no help.

I've been trying to help you for over four days and all I've gotten are insults.


This is not a question of anyone trying to prove how smart they are, it is about decency and politeness. The next time you ask someone for help, try not to spit in their face, OK? That's just not cool.


You may continue your previous abuse. I'm not going to listen any longer.

Aug 10, 2012 11:32 PM in response to megagram

Hi


I have a Macbook early 2011 and a Macbook pro Retina both with Mountain Lion. Yesterday I moved my Aperture Library to the new Retina Mac. So I started the Aperture and try to sort out pictures that are not required. After some minutes the new Macbook was the switch to another picture it was extreamly slow


I opend the activty Monitor ... swap more than > 3GB

But the joke was that enough system memory was free !!


If the system is booted and I use some applications all is fine, if you open Aperture (in my case) and you only watch photos he will begin to swap.


So it is Mountain Lion caused or Aperture .. I think 😝

Both Macbooks have the same behavoir !


Regards


Frank

Aug 11, 2012 12:46 AM in response to fbeckman

Note among other things that memory availability as reported by Activity Monitor does not reflect the granularity of the free memory nor does it reflect the fact that swap sizes grow in large increments.


For example, if free memory were fragmented such that 5 GB total were available but only in disparate 1 GB chunks, the OS may have needed to write 2+ GB to swap in order to fulfill a request for 2 GB of continuous space.


Swap isn't only used when RAM is exhausted in total but instead may be needed when memory of the requested type has been exhausted.

Aug 11, 2012 1:21 AM in response to Dogcow-Moof

Hi William


I disabled swap for testing, if I used Aperture the memory will be blow up extreamly (photo switching slows down). Iphoto with the same pictures not. In the moment I try different Applictions and he has not swap out anything... (enabled swap again)


I'm a little bit supprised, under Lion I had no trouble with memory and swapping (all Macbooks have 8G RAM). In my vaction I worked with Apertue (Lion, Mountain Lion was not released) and it was never a problem with the performance.


They changed the memory management in Mountain Lion ?


My opinion is that swapping is posion for my SSD's 😟


Regards


Frank

Aug 11, 2012 5:22 AM in response to fbeckman

fbeckman wrote:


They changed the memory management in Mountain Lion ?

Lion runs with a 32-bit kernel by default. In Mountain Lion, that changed to the 64-bit kernel. Some applications that were limited in their RAM consumption before are no longer limited. I don't know about Aperture, but I know Photoshop behaves entirely differently. In Lion, Photoshop is limited to 3.2 GB of RAM but in Mountain Lion it can have it all. There is probably something similar going on with Aperture. You can try Adobe's instructions on running in 32-bit mode if you feedl RAM-constrained.

Aug 11, 2012 12:18 PM in response to etresoft

I just shudder to think how many of those people who marked one of your posts as "Helpful" (as I did in the beginning of this thread) because it seemed like it would provide the correct answer. Until of course I asked for clarification and a source and you couldn't back it up--it was just some weird hunch that you had developed. Great. Wish I could take back the "helpful" tag. Oh well.

Aug 13, 2012 11:47 AM in response to David A. Gatwood

That was just a suggestion thrown out for someone to try. I have noticed a trend of otherwise reasonable people who claim that Lion/Mountain Lion needs at least 8 GB to run comfortably. I have been unable to reproduce any unusual virtual memory issues in Lion even when running in a 2 GB VM and opening 2 GB images. The difference is always that those people run Photoshop and I don't. Perhaps Photoshop does need 8GB in Lion whereas it ran fine with 4 in Snow Leopard - but that's Photoshop's problem. Why not stock up on RAM if you can afford Photoshop. It's just piles and piles of money.

Aug 13, 2012 12:16 PM in response to etresoft

Hi


I've 8GB of RAM.


It could be an issue of the kernel scan rates (hi / low marks ) ... If you open many pictures successively, you see the available free mem will be decrease very fast (switch from photo to another). Then he begins to swap !

If you do nothing the free mem will be increase but the swap out memory will be swaped out. If I close Aperture the swap will be decrase, but a little bit pageout data will be there.. That are other applications that are swaped out by the kernel.


Regards


Frank

Aug 18, 2012 11:57 AM in response to bobpage87

I would agree. My 2.5 GHz Intel Core i5 iMac with 12GB never had the slightest problem until Mountain Lion.


Now, mid afternoon or so, it starts getting slower and slower and although I can't see anything in "w" or Activity Monitor or "top" that seems out of place, there ARE large numbers of swap files and I think this starts after the system has been running its screen saver..


When it last turned to molassess, all I was running was two Chrome Windows with a total of 28 tabs and two terminal windows with a total of 5 tabs.


That's it.

Aug 19, 2012 5:03 PM in response to nalundgaard

Well, here's what appears to be my culprit... no hints as to the source. For now, I am disabling hibernation (by running sudo pmset -a hibernatemode 0 in terminal). That seems to correct the issue entirely.


Anwyay, heres my log snippet. I bolded the parts that appear to correspond to the swapping, which is happening during the hibernation process:


********************************************

8/19/12 6:52:42.262 PM com.apple.time[11]: Next maintenance wake [Backup Interval]: <date: 0x7f9258e12bb0> Sun Aug 19 19:16:07 2012 CDT (approx)

8/19/12 6:52:42.262 PM com.apple.time[11]: Requesting maintenance wake [Backup Interval]: <date: 0x7f9258e12bb0> Sun Aug 19 19:16:07 2012 CDT (approx)

8/19/12 6:52:42.277 PM WindowServer[1336]: Created shield window 0xa4 for display 0x042803c0

8/19/12 6:52:42.307 PM WindowServer[1336]: device_generate_desktop_screenshot: authw 0x7fbee4d00370(2000), shield 0x7fbee2a63870(2001)

8/19/12 6:52:42.414 PM WindowServer[1336]: device_generate_lock_screen_screenshot: authw 0x7fbee4d00370(2000), shield 0x7fbee2a63870(2001)

8/19/12 6:52:43.000 PM kernel[0]: hibernate image path: /var/vm/sleepimage

8/19/12 6:52:43.000 PM kernel[0]: sizeof(IOHibernateImageHeader) == 512

8/19/12 6:52:43.000 PM kernel[0]: AirPort_Brcm43xx::powerChange: System Sleep

8/19/12 6:52:43.000 PM kernel[0]: kern_open_file_for_direct_io(0) took 1 ms

8/19/12 6:52:43.000 PM kernel[0]: Opened file /var/vm/sleepimage, size 17179869184, partition base 0x0, maxio 400000 ssd 1

8/19/12 6:52:43.000 PM kernel[0]: hibernate image major 1, minor 0, blocksize 512, pollers 4

8/19/12 6:52:45.000 PM kernel[0]: (default pager): [KERNEL]: ps_allocate_cluster - send HI_WAT_ALERT

8/19/12 6:52:45.000 PM kernel[0]: macx_swapon SUCCESS

8/19/12 6:52:45.000 PM kernel[0]: (default pager): [KERNEL]: ps_select_segment - send HI_WAT_ALERT

8/19/12 6:52:45.000 PM kernel[0]: macx_swapon SUCCESS

8/19/12 6:52:45.000 PM kernel[0]: (default pager): [KERNEL]: ps_select_segment - send HI_WAT_ALERT

8/19/12 6:52:45.000 PM kernel[0]: macx_swapon SUCCESS

8/19/12 6:52:45.000 PM kernel[0]: (default pager): [KERNEL]: ps_select_segment - send HI_WAT_ALERT

8/19/12 6:52:45.000 PM kernel[0]: macx_swapon SUCCESS

8/19/12 6:52:48.000 PM kernel[0]: (default pager): [KERNEL]: ps_select_segment - send HI_WAT_ALERT

8/19/12 6:52:48.000 PM kernel[0]: macx_swapon SUCCESS

8/19/12 6:52:52.000 PM kernel[0]: hibernate_alloc_pages flags 00000000, gobbling 0 pages

8/19/12 6:52:52.000 PM kernel[0]: hibernate_setup(0) took 9067 ms

8/19/12 6:52:54.000 PM kernel[0]: IOThunderboltSwitch(0x0)::listenerCallbackStatic - Thunderbolt HPD packet for route = 0x0 port = 11 unplug = 0

8/19/12 6:52:54.000 PM kernel[0]: IOThunderboltSwitch(0x0)::listenerCallbackStatic - Thunderbolt HPD packet for route = 0x0 port = 12 unplug = 0

8/19/12 6:52:54.000 PM kernel[0]: hibernate_page_list_setall start 0xffffff803fb45000, 0xffffff82393ac000

8/19/12 6:53:01.000 PM kernel[0]: hibernate_page_list_setall time: 490 ms

8/19/12 6:53:01.000 PM kernel[0]: pages 1364096, wire 458314, act 356698, inact 63640, cleaned 0 spec 239390, zf 246054, throt 0, could discard act 0 inact 0 purgeable 0 spec 0 cleaned 0

8/19/12 6:53:01.000 PM kernel[0]: hibernate_page_list_setall found pageCount 1364096

8/19/12 6:53:01.000 PM kernel[0]: IOHibernatePollerOpen, ml_get_interrupts_enabled 0

8/19/12 6:53:01.000 PM kernel[0]: IOHibernatePollerOpen(0)

8/19/12 6:53:01.000 PM kernel[0]: encryptStart 13310

8/19/12 6:53:01.000 PM kernel[0]: writing 1355102 pages

8/19/12 6:53:01.000 PM kernel[0]: hibernate_machine_init: state 2, image pages 458110, sum was 45082592, image1Size 28d87a00, conflictCount 4589, nextFree 51bf

8/19/12 6:53:01.000 PM kernel[0]: IOHibernatePollerOpen(), ml_get_interrupts_enabled 0

8/19/12 6:53:01.000 PM kernel[0]: IOHibernatePollerOpen(0)


********************************************

Any hints appreciated, but at this point I am filing a bug report with Apple. This is an annoying waste of my SSD's write cycles. Technically, hibernation in general is, so I guess it's just as well.

Aug 19, 2012 5:16 PM in response to nalundgaard

Hey, I'm still having the problem!


Fontworker was the culprit for high CPU activity when waking from sleep, which I only suspected was also doing the swapfile creation.

But, alas, I am still having the issue: tons of swapspace being used despite 50% free memory and, like you point out, no pageouts!


I don't use hibernation. I'm on mode setting 3 for hibernatemode. I will try setting to 0 and deleting my sleepimage file for now as a test.


Good sleuthing!

Aug 20, 2012 6:45 PM in response to nalundgaard

Hey, great info for those not familiar with the sleep mode settings. I'm fine with the risk (given the max. 30 days standby time of the MBPr, I'm not too worried).


So, after a couple days, I have zero swap space used.


My wake up times from sleep are INSTANT now.


Definitely a bug or something weird going on.


I will be filing a bug report as well.


Good work!

Over 3GB of swap files with 16GB of RAM?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.