Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hormelmeatcompa

macrumors member
Original poster
Aug 28, 2009
32
0
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?
 

Intell

macrumors P6
Jan 24, 2010
18,955
509
Inside
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.
 

hormelmeatcompa

macrumors member
Original poster
Aug 28, 2009
32
0
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.
 

Intell

macrumors P6
Jan 24, 2010
18,955
509
Inside
Are you sure its because of swap usage? Post a screenshot of your Activity Monitor set to the System Memory tab.
 

hormelmeatcompa

macrumors member
Original poster
Aug 28, 2009
32
0
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.
 

MacManiac76

macrumors 68000
Apr 21, 2007
1,841
676
Arizona
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.
 

Quad5Ny

macrumors 6502a
Sep 13, 2009
984
22
New York, USA
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
 
Last edited:

hormelmeatcompa

macrumors member
Original poster
Aug 28, 2009
32
0
@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.
 

johnfkitchen

macrumors regular
Sep 7, 2010
210
0
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.

Which means either too much concurrent work, or too little RAM. Any Page Outs mean you have run out of RAM at some time.
 

Nuckinfuts

macrumors 6502
Jun 15, 2011
398
0
Syracuse, NY
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?

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.

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.
 

hormelmeatcompa

macrumors member
Original poster
Aug 28, 2009
32
0
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.

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.
 

Nuckinfuts

macrumors 6502
Jun 15, 2011
398
0
Syracuse, NY
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.

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
 

MacManiac76

macrumors 68000
Apr 21, 2007
1,841
676
Arizona
Which means either too much concurrent work, or too little RAM. Any Page Outs mean you have run out of RAM at some time.

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.
 

Nuckinfuts

macrumors 6502
Jun 15, 2011
398
0
Syracuse, NY
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.

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
 

johnfkitchen

macrumors regular
Sep 7, 2010
210
0
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

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.
 

Nuckinfuts

macrumors 6502
Jun 15, 2011
398
0
Syracuse, NY
But he said "It's not doing it now as I just rebooted[...]It'll start soon enough."

The numbers don't lie

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.

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
 

MacManiac76

macrumors 68000
Apr 21, 2007
1,841
676
Arizona
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

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.
 

tkermit

macrumors 68040
Feb 20, 2004
3,582
2,909
The numbers don't lie
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.
 

Nuckinfuts

macrumors 6502
Jun 15, 2011
398
0
Syracuse, NY
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.

... if you don't fill the RAM it won't crash, farmville isn't gonna do it

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.

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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.