Setting pagefile size manually

Discussion in 'Mac OS X Lion (10.7)' started by hormelmeatcompa, Aug 17, 2011.

  1. hormelmeatcompa macrumors member

    Joined:
    Aug 28, 2009
    #1
    Are there any tools anyone has found to defrag the pagefile?

    If not, is there a way to set the amount of virtual memory manually? One trick I always used on Windows to boost performance if my disk was always thrashing heavily was to set the pagefile to be 0MB, reboot, set it back to what it was and then reboot again. Is there a way to do this on OS X?
     
  2. Intell macrumors P6

    Intell

    Joined:
    Jan 24, 2010
    Location:
    Inside
    #2
    Mac OS X handles memory very differently when compared to Windows. There isn't any way to change the swap file and there should be no reason why its settings should be altered.

    Macs and their swap files do not need to be defragmented. All defragmentation is handled automatically by the underlying disk format. The only reason why is if you need a large continuous block of free space to partition the drive.
     
  3. hormelmeatcompa thread starter macrumors member

    Joined:
    Aug 28, 2009
    #3
    I've read comments similar to what you've said, but despite OS X's supposedly good memory management, the problem still exists: constant beach balls due to massive disk thrashing with the pagefile.
     
  4. Intell macrumors P6

    Intell

    Joined:
    Jan 24, 2010
    Location:
    Inside
    #4
    Are you sure its because of swap usage? Post a screenshot of your Activity Monitor set to the System Memory tab.
     
  5. hormelmeatcompa thread starter macrumors member

    Joined:
    Aug 28, 2009
    #5
    It's not doing it now as I just rebooted: 545MB page ins, 0MB page outs, 0MB of pagefile used. It's a 2011 i5 MBP with 4GB of RAM.

    It'll start soon enough.
     
  6. MacManiac76 macrumors 65816

    MacManiac76

    Joined:
    Apr 21, 2007
    Location:
    White Mntns, Arizona
    #6
    I got tired of my system using the page file for no reason, so I just disabled use of the page file using Onyx. Programs seem to load faster and I have had no problems with beach balling or programs crashing since disabling the page file.
     
  7. Quad5Ny, Aug 17, 2011
    Last edited: Aug 17, 2011

    Quad5Ny macrumors 6502a

    Quad5Ny

    Joined:
    Sep 13, 2009
    Location:
    New York, USA
    #7
    I don't believe OS X has a pre-allocated swap/page file. Some Unix/Linux distros use separate partitions for their swap, but OS X is not one of them.

    The way I understand it is; OS X starts with no space allocated for swap and when it needs it, it will grab a block of free HD space. Then after it's done or on a reboot, it will free that space again.

    As for Windows there is no need to defragment the pagefile. Its either a huge pre-allocated block of space (that does not fragment) or a small file that grows when needed and is shrunk back to it's original size during restarts.


    Theres no reason to defragment page/swap files. Data is usually read/write 4KB (the size of a memory page) at a time, so even if it was horribly fragmented, defragmenting would have very little practical benefit. Your best bet would be to find what's using up all your memory or to buy more RAM.

    More info: http://support.apple.com/kb/ht1342, http://developer.apple.com/library/...tual/ManagingMemory/Articles/AboutMemory.html
     
  8. hormelmeatcompa thread starter macrumors member

    Joined:
    Aug 28, 2009
    #8
    @Macmaniac: Thanks! I've used Onyx for awhile and didn't even know it had that ability. I didn't disable it but chose "Reload" instead and that seems to work pretty well.

    @Quad5Ny: Dynamically resizing the pagefile was what caused me so much grief in Windows. Setting it to be a fixed size is what helped.
     
  9. johnfkitchen macrumors regular

    Joined:
    Sep 7, 2010
    #9
    Which means either too much concurrent work, or too little RAM. Any Page Outs mean you have run out of RAM at some time.
     
  10. hormelmeatcompa thread starter macrumors member

    Joined:
    Aug 28, 2009
    #10
    I almost regret asking. It seems like too many here have drunk the Koolaid.
     
  11. Nuckinfuts macrumors 6502

    Joined:
    Jun 15, 2011
    Location:
    Syracuse, NY
    #11
    This is unwise since most *nix systems crash if there is no swap and you fill up your RAM. I cannot confirm this behavior on Mac but I know it's true for Linux.

    If you disable swap, you're dumb.
     
  12. tkermit macrumors 68040

    tkermit

    Joined:
    Feb 20, 2004
  13. hormelmeatcompa thread starter macrumors member

    Joined:
    Aug 28, 2009
    #13
    Not enough $$$. And 4GB isn't a small amount.
     
  14. tkermit macrumors 68040

    tkermit

    Joined:
    Feb 20, 2004
    #14
    That kind of depends on what you're doing. Obviously you're using it all up?!
    Isn't 8 gigs of RAM like $50 right now? I would think about it.
     
  15. hormelmeatcompa thread starter macrumors member

    Joined:
    Aug 28, 2009
    #15
    I'm just doing web browsing, iTunes, email, etc. Nothing intensive at all. $50 is alot when you have $30 to last you the rest of the month for food, etc.
     
  16. Nuckinfuts macrumors 6502

    Joined:
    Jun 15, 2011
    Location:
    Syracuse, NY
    #16
    He's not even using it all up.

    Here's my laptop, it's a 13" MBP from 2010 so it has a Core2 Duo in it, so yours is better. I upgraded mine to 8Gb of RAM and here is my memory activity:

    Free: 4.29GB
    Wired: 1.14GB
    Active: 2.17GB
    Inactive: 400MB

    VM Size: 245GB (yes, GIGAbytes)
    Page-Ins: 3.93GB
    Page-outs: 0...
    swap used: 0...

    Page ins don't matter, only page outs
     
  17. MacManiac76 macrumors 65816

    MacManiac76

    Joined:
    Apr 21, 2007
    Location:
    White Mntns, Arizona
    #17
    This is supposed to be the case, but it is indeed not in OS X. I have had page outs several times when free RAM has been around 800MB-1GB free. I keep track of my RAM usage using iStat Menus so I know at any instant how much RAM is used or free.
     
  18. Nuckinfuts macrumors 6502

    Joined:
    Jun 15, 2011
    Location:
    Syracuse, NY
    #18
    Page outs simply mean that the OS recognized that there is information in the swap file that it can use instead of reprocessing it again, it's a good thing
     
  19. tkermit macrumors 68040

    tkermit

    Joined:
    Feb 20, 2004
    #19

    But he said "It's not doing it now as I just rebooted[...]It'll start soon enough."
     
  20. johnfkitchen macrumors regular

    Joined:
    Sep 7, 2010
    #20
    With all due respect, if something is in the swap file that can be used, then that would be a Page In, not a Page Out.

    Page Outs are always bad, because they cause delay and are typically followed by a later need to page back in causing another delay. They are overhead. Ideally, there is no swap file.
     
  21. Nuckinfuts macrumors 6502

    Joined:
    Jun 15, 2011
    Location:
    Syracuse, NY
    #21
    The numbers don't lie

    Yes sorry I had those backwards but your point is mute, yes Page Outs are bad since you have double disc access but I'd rather have that than a system crash
     
  22. MacManiac76 macrumors 65816

    MacManiac76

    Joined:
    Apr 21, 2007
    Location:
    White Mntns, Arizona
    #22
    Still waiting for that system crash to happen after almost of month of having the page file disabled. If and when that supposed crash does happen I guess I'll know for sure that I need more RAM. Not worried at all here.
     
  23. tkermit macrumors 68040

    tkermit

    Joined:
    Feb 20, 2004
    #23
    Yes. But he posted the numbers from right after a reboot. Of course they look fine. After using the machine for a while though, he certainly appears to be getting a lot of page outs. Otherwise he wouldn't have a problem with constant beach balls.
    Seems to me that he would almost certainly profit from more RAM.
     
  24. Nuckinfuts macrumors 6502

    Joined:
    Jun 15, 2011
    Location:
    Syracuse, NY
    #24
    ... if you don't fill the RAM it won't crash, farmville isn't gonna do it

    I'm not saying he won't benefit from more RAM, most people would, but based on the information provided by the OP, it's something else causing the beachball
     

Share This Page