Limiting size of VM swap files: Possible?

Discussion in 'MacBook Pro' started by germinator, Jun 13, 2010.

  1. germinator macrumors regular

    Apr 22, 2009
    This is a rather technical post, sorry.

    I have the new 15" with SSD (80 GB Intel) and HDD (500 GB). I have put System and Apps on the SSD, while the user's home directory is on the HDD.

    So far so good, performance is great.

    But I have run into the problem of getting the "Memory on the startup disk is too small" warning twice. That's a pretty unpleasant experience, with apps freezing etc. Of course, nominally my startup disk (the SSD) is far from full, since the apps occupy maybe 30 GB and the System maybe 15. I should have over 30 GB of available disk space.

    So what happened?

    I found out that the culprit is virtual memory. Somehow my system at some point thought that it needed a lot of VM (around 40 GB), and the VM daemon started writing swap files (up to 40 of them!) on the startup volume, until it got full.

    After quitting some apps, somehow the situation gets corrected and the system automatically reduces the number of the swap files again.

    What are my options to keep this unpleasant problem from occurring again in the future? Here are the ones I can think of:

    1. Move the VM directory to HDD. I don't like to do this because it would significantly hurt performance.

    2. Create an additional partition (~10-20 GB or so) on the SSD, then move the VM directory to that partition. This way, I always know the max. size of VM and I won't be surprised. Disadvantages: I will need to repartition the SSD and re-install system and all apps. And I may be wasting precious space on the SSD.

    3. The ideal solution would be an option in the VM daemon to limit the total VM size. I have perused the man pages, but I can only see an option to set the size of each individual swap file, not the overall VM size.

    Thought? Suggestions?
  2. Str8edgepunker macrumors 6502

    Nov 4, 2001
    Philadelphia, PA
    Umm, sounds like there's something deeply wrong there. You'd better check the console and see if there's any entries there that keep repeating themselves.
  3. Objectivist-C macrumors 6502

    Jul 1, 2006
    Sounds like something's gone awry, unless you're working with particularly enormous datasets or something. I've never exceeded a 2GB swap file in a machine with 1GB of RAM.
  4. germinator thread starter macrumors regular

    Apr 22, 2009
    Nothing particular in Console logs. But you are right that something went awry. If I remember correctly, mds was taking a lot of memory. At the time when the problem occurred, I did not know it was cause by VM. So I did not try to find out the culprit app that caused this abnormal need for VM. All I can say is that after quitting some of the apps all reverted to normal.

    It happened twice since I have had my MacBook Pro, so it's not a frequent occurrence.
  5. germinator thread starter macrumors regular

    Apr 22, 2009
    To be precise: It's not the size of the pagefiles that is large (they are 1 GB each), it's the number of them that is excessive.

Share This Page