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

Swapfile's out of control

Okay - I cannot account for quite a few Gig's on my HD. I ran WhatSize and came across 44.0 GB in Private/Var/VM. 4.29 GB was the sleepimage, but I have Swapfiles's 5 - 40 at 1.07 GB each (approx. 37 GB total).


In terminal, I ran:


sudo du -h -d1 /var/vm

Password: *****

37G /var/vm


My suspicion is that this is highly unusual, but I've been cautioned to avoid deleting or messing with them.


Is this indeed unusual? Are there any suggested remedies?



Your help is very much appreciated.



Thanks!

MacBook Pro (13-inch Mid 2009), Mac OS X (10.6.8)

Posted on Feb 12, 2012 11:37 PM

Reply
26 replies

Feb 12, 2012 11:44 PM in response to Nightshade0six

When was the last time you rebooted?


Out of curiousity do this:


ls -la /var/vm


Do not under any circumstances delete any files in /var/vm. You cannot "manually" delete the swap space. You do and you will be rebooting soon!😉


The sleepimage is the file that is written when you deep sleep (hibernate) your machine. It should be about the same size as the amount of ram you have.

Feb 12, 2012 11:49 PM in response to X423424X

Thank you -


Using the command you mentioned:


total 81788928

drwxr-xr-x 44 root wheel 1496 Feb 12 23:42 .

drwxr-xr-x 26 root wheel 884 Nov 14 2009 ..

-rw------T 1 root wheel 2147483648 Feb 12 23:42 sleepimage

-rw------- 1 root wheel 67108864 Feb 12 23:24 swapfile0

-rw------- 1 root wheel 67108864 Feb 12 23:46 swapfile1

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile10

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile11

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile12

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile13

-rw------- 1 root wheel 1073741824 Feb 12 23:24 swapfile14

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile15

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile16

-rw------- 1 root wheel 1073741824 Feb 12 23:24 swapfile17

-rw------- 1 root wheel 1073741824 Feb 12 23:24 swapfile18

-rw------- 1 root wheel 1073741824 Feb 12 23:24 swapfile19

-rw------- 1 root wheel 134217728 Feb 12 23:46 swapfile2

-rw------- 1 root wheel 1073741824 Feb 12 23:24 swapfile20

-rw------- 1 root wheel 1073741824 Feb 12 23:24 swapfile21

-rw------- 1 root wheel 1073741824 Feb 12 23:24 swapfile22

-rw------- 1 root wheel 1073741824 Feb 12 23:24 swapfile23

-rw------- 1 root wheel 1073741824 Feb 12 23:24 swapfile24

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile25

-rw------- 1 root wheel 1073741824 Feb 12 23:24 swapfile26

-rw------- 1 root wheel 1073741824 Feb 12 23:24 swapfile27

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile28

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile29

-rw------- 1 root wheel 268435456 Feb 12 23:24 swapfile3

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile30

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile31

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile32

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile33

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile34

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile35

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile36

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile37

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile38

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile39

-rw------- 1 root wheel 536870912 Feb 12 23:46 swapfile4

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile40

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile5

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile6

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile7

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile8

-rw------- 1 root wheel 1073741824 Feb 12 23:46 swapfile9


I've shut down and restart a couple times over the past few (3-7) days although I should definitely do it more so than current.


I also dumped the sleepimage earlier through terminal after reading several posts on the subject. It was double the size of my RAM and from my understanding will reappear on next hibernation.

Feb 12, 2012 11:57 PM in response to Nightshade0six

I also dumped the sleepimage earlier through terminal after reading several posts on the subject. It was double the size of my RAM and from my understanding will reappear on next hibernation.

If you want to turn of hibernation you can with pmset for hibernatemode (man pmset).


41 swap files and only running under 7 days. Yup, that's a bit excessive! Sounds like you are running some process that may have a memory leak. Might want to monitor memory with top or Activity Monitor.


I guess I have to ask, how much ram do you have and how many apps do you keep concurrently running?

Feb 13, 2012 12:01 AM in response to X423424X

I have 2GB RAM and run minimal apps. Right now I have 188.48 MB available and am running Chrome, Terminal and Whatsize. Earlier it was between 8-12 MB running the same apps plus or minus one (such as activity monitor).


I did however add a Virtual Box VM for Windows 7 a couple days ago - I don't see how, but could this be part of the issue?

Feb 13, 2012 12:05 AM in response to Nightshade0six

If you look at Activity Monitor or do a top I think virtual box has a bunch of launchagents or launchdaemons (don't recall at the moment) which may be running and maybe they could be sucking up resouces. You only have 2GB which IMO is a pretty small amount which might explain the excessive paging.


Check these dirctories,


/Library/LaunchAgents

/Library/LaunchDaemons

/Library/StartupItems


You might want to experiment and consider uninstalling Virtual Box.

Feb 13, 2012 12:27 AM in response to Nightshade0six

Nightshade0six wrote:


I have 2GB RAM and run minimal apps. Right now I have 188.48 MB available and am running Chrome, Terminal and Whatsize. Earlier it was between 8-12 MB running the same apps plus or minus one (such as activity monitor).

2GB is somewhat minimal on 10.6. As long as you ran minimal apps, you might not notice, but I'll bet you already had some swap files going with just 2GB RAM. I completely agree with the recommendation above to go to 4GB. I do graphics and Photoshop, so for me personally I won't buy a new Mac today with less than 8GB, but that might not apply to you.


Nightshade0six wrote:


I did however add a Virtual Box VM for Windows 7 a couple days ago - I don't see how, but could this be part of the issue?

Oh dear.


Adding a Windows virtual machine changes EVERYTHING. Not only do you have to run Mac OS X, but you also have to run VirtualBox, and on top of those two you must also meet the minimum system requirements of Windows. You must now meet a minimum configuration for running two complete operating systems simultaneously in only one computer, since Windows 7 is running inside Mac OS X. This is a recipe for exploding swap files, because you can't easily fit both Mac OS X and any recent version of Windows into just 2GB RAM. And that's before opening a RAM-hungry app in either OS.


I have a lot more RAM in my Macs but I still see swap files increase when running Windows, since it's about booting up a whole other computer inside the same computer. If I'm already using up my RAM with Photoshop or other apps, I fully expect many more swap files to appear because I'm not leaving much RAM for a whole other OS to run.


If you ran Windows in Boot Camp (i.e. booting the Mac into Windows alone), it would be less of a burden on the RAM, because only Windows would be running, as long as you don't mind not being able to use the Mac side. Or you could just add a bunch of RAM.

Feb 13, 2012 12:35 AM in response to Network 23

I'm not familiar with VirtualBox which is why I didn't jump all over it in my earlier posts other than suggesting its removal due to continually running daemons (at least I think they are running). But I am not sure it has a full windows system running inside it. Only enough of an environment to support windows executables which I would hope (only hope) would be less than a full windows environment. It's still though probably a memory hog.

Feb 13, 2012 4:26 AM in response to Nightshade0six

Nightshade0six: in var/vm 44GB is crazy, in my MBP2009 running Lion it is 66MB (I have no sleepimage because I have hibernatemode set to 0) ! And I have Parallels Desktop running with TWO VM's: XP and W7.

Indeeed what worries me too is that your sleepimage is twice the size of the Ram, normally it is just the size of the Ram.

The Windows VM's are just large size files and normally they are not in the vm folder, how many files are in the vm folder?

Swapfile's out of control

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