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

Gigantic /var/vm folder - 26GB

I have MacBook Pro "13, latest series, 8GB RAM & SSD 256GB.

My /var/vm folder has became VERY big, much more than the expected 8GB. All files' last modified is today.

I once deleted them all and got a Kernel Panic, then after a restart they have been created again.

Is there anything I could do to reduce the size? What will it affect?

I have read several threads about this folder but most of them talk about 2-4 GB of size.


Thanks


8.0G sleepimage

64M swapfile0

64M swapfile1

1.0G swapfile10

1.0G swapfile11

1.0G swapfile12

1.0G swapfile13

1.0G swapfile14

1.0G swapfile15

1.0G swapfile16

1.0G swapfile17

1.0G swapfile18

1.0G swapfile19

128M swapfile2

256M swapfile3

512M swapfile4

1.0G swapfile5

1.0G swapfile6

1.0G swapfile7

1.0G swapfile8

1.0G swapfile9

Macbook Pro 2011 Q1 13" i7 2.7Ghz 8GB RAM, 256GB SSD / iPhone 4 (4.3.1), Mac OS X (10.6.7)

Posted on Jun 12, 2011 10:34 AM

Reply
29 replies

Jun 12, 2011 3:11 PM in response to Linc Davis

Still not sure what can indicate it. For example, Xcode 4 now is 340MB, Chrome with all its processes is >1GB.

~ 3GB free out of 8GB. All the rest are less meaningful.

After some work, Xcode can get to 500-600 MB.

Sometimes when it gets above 1GB I kill it. Could this be a problem?

And why do the swap files exceed the RAM I have, anyway?


Thanks.

Jun 12, 2011 8:00 PM in response to Linc Davis

So one of these apps (Xcode, Chrome etc.) is causing these files to grow because is has a memory leak, and the only way to handle it is not using it or rebooting when the swap directory gets bloated?

Just sounds weird to me that OS X doesn't handle it by limiting swap files and there's nothing else that can be done about it.


Thank you.

Jun 13, 2011 6:58 AM in response to elado

If you are NOT running out of disk space, and you are not experiencing performance issues, then do nothing. Mac OS X is just doing its job.


NOTE: The sleepimage is ONLY used when you sleep your Mac. The pagefiles are used when you are running your mac. Since you have 8GB of RAM, your minimum /var/vm is going to be 8GB + 64MB, but that will grow over time as you run more concurrent applications.


The pagefiles will NOT go away on their own, only as a reboot. But what this means is that they indicate a peak memory usage, not your current usage. So if you have times during the day when you are either running a very memory intensive app, or lots more concurrent apps, then your pagefile usage will go up, and stay there. However, when you take a look, you may only be running a few apps that are not using all that storage, but the storage will remain in case you do need it again.


Your usage has created the pagefiles. If you are not out of disk space, do not worry about it. If you are running out of disk space, either get a bigger disk, find some files that you really do not need anymore (OmniDiskSweeper can help), or alter your computing habits so you do not need this much concurrent memory.

Jun 15, 2011 1:43 PM in response to BobHarris

Thanks for the detailed answer.


Right, after a reboot the contents of this folder weigh much less.

After two/three days of normal usage as a developer (mostly Xcode) it has become ~24GB again.


When it gets bloated like this, the disk gets out of space. Getting a bigger SSD (than 256GB) is too expensive, and anyway that seems like a software, OS issue.

I've already used WhatSize to find the largest files and folders, anything I have is essential. And anyway, if I delete stuff, it can even exceed the 50GB after a while so that doesn't promise me it would be better.


Rebooting occasionally reminds me of Windows, obviously not a solution.


I would change habits, but how? I don't use anything special.


Thanks again.

Jun 15, 2011 2:03 PM in response to elado

Something you are running is requiring all that current memory, way in excess of your 8GB of physical RAM. Only you can figure out what that is.


Watching Activity Monitor is generally something most people will not do on a regular enough basis to actually catch the offending set of applications.


You might try doing something like creating a shell script that runs the 'ps' command with the options needed to capture the RSZ (real memory size) information every 'n' seconds into a file. Then maybe you can go back and analyze the output to find the time period when all that memory was needed, and then hopefully identify the offending apps.


If you are a developer, is it possible the application you are developing is sometimes being a memory hog while you are debugging it?


Maybe it is just Xcode. I do not use it much, so I don't know how memory intensive it is. Then again, Xcode is more a collection of different apps that are run via Xcode, so it is also possible that Xcode will run lots of stuff in parallel that are fighting for memory.


Again, you are the only one that can tell what you are running, and analyze their memory usage.

Nov 24, 2011 3:55 AM in response to elado

Not sure if the OP found the source of the issue, but I've got exactly the same problem in Lion. My /var/vm folder size is up to 26GB and I'm running with a 115GB SSD so it's filling all my available space.


The only 'big' application I use is Aperture but it would be good to know if there's a mechanism to manual clear the swap files or limit the maximum size of them?

Jun 2, 2012 11:33 PM in response to elado

This is a repost from another related thread. The problem gets reported in many places, but no-one ever joins the dots to illustrate that it is fundamental memory management bug in the OS.


......


This is an on-going and serious OS X bug. It is NOT confined to Lion, although that may have made it worse for some people. I experienced ths problem with Snow Leopard as well.


The problem is not with any particular apps, although it may start there. You can shut everything down on the system, and the swap will still not be freed. That's an OS X problem, because the processes that generated any memory leak have gone away, but OS X doesn't want to know.


The other symptom you will see is that the system will slow down dramatically, because activitymonitord is chewing up increasing percentages of CPU. I have seen activitymonitord running at over 40% of a CPU. That's impressive, and that was on Snow Leopard.


Apple needs to fix this, but they don't seem to be interested.

Gigantic /var/vm folder - 26GB

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