Previous 1 2 Next 29 Replies Latest reply: Jun 16, 2012 10:43 PM by Kevin Stanchfield
elado Level 1 Level 1 (5 points)

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)
  • Linc Davis Level 10 Level 10 (164,900 points)

    You must be running a process with a huge memory leak. Don't delete the swapfiles -- that happens automatically when you reboot. Launch the Activity Monitor application and watch for processes whose memory allocation increases with time.

  • elado Level 1 Level 1 (5 points)

    There are plenty - Xcode, Chrome, Tower (a git client). They all can get to 1-1.5 GB RAM consumption.

    Can I somehow limit the files size?

  • Linc Davis Level 10 Level 10 (164,900 points)

    No. What matters is not the size but how it changes over time. You'll probably find that one process keeps growing and eventually dominates. It will almost certainly be a third-party application.

  • elado Level 1 Level 1 (5 points)

    Thanks.

    How would I find such thing? The memory consumption of the apps I mentioned is inconsistent.

  • Linc Davis Level 10 Level 10 (164,900 points)

    As I said, by watching how the memory allocation of the processes changes over time.

  • elado Level 1 Level 1 (5 points)

    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.

  • Linc Davis Level 10 Level 10 (164,900 points)

    I don't think there's much point in my saying for a third time that you have to watch to see which process' memory allocation keeps growing indefinitely. There's no relationship between the amount of physical RAM installed and the size of the VM backing store.

  • elado Level 1 Level 1 (5 points)

    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.

  • BobHarris Level 6 Level 6 (15,600 points)

    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.

  • elado Level 1 Level 1 (5 points)

    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.

  • BobHarris Level 6 Level 6 (15,600 points)

    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.

  • Linc Davis Level 10 Level 10 (164,900 points)

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

     

    I hadn't thought of that. I'll bet that's the answer.

  • ChiefSilveback Level 1 Level 1 (0 points)

    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?

  • elado Level 1 Level 1 (5 points)

    I got sick of it last week and I formatted the system and did a clean install. Now it reaches 14 tops, with same applications, habits and uptime.

     

    That looks like a serious bug in the system's memory management to me.

Previous 1 2 Next