[X-Unix] Panthers Virtual Memory

Adrian Simmons adriman at ntlworld.com
Sat Mar 27 06:17:57 PST 2004


Eugene Lee wrote:
> Yep, this is the new behavior for Panther, which is not documented in
> the included man page.
Well, it does say:
"-S    The fixed filesize [in bytes] to use for the paging files.  By
        default dynamic_pager uses variable sized paging files, using
        larger sized files as paging demands increase.  The -S, -H and -L
        options disable that default and cause dynamic_pager to use a
        series of fixed sized external paging files."

Not *well* documented though.

> Panther uses more VM than previous versions of OS X (in
> my biased experience).
It's not just you, tons of people are saying this. But from what I can 
gather this isn't so much more vm *use* as just more swapfile creation 
and not disposing of unused swapfiles.

> You can still try "dynamic_pager -S filesize"
> but I haven't looked at the source to see if Panther even cares about
> some of those switches.
 From what I've googled this morning it looks like the options used in 
Jaguar still work, it's just Apple hasn't set any in /etc/rc.


> Solution?
> 	- Reboot more regularly.  This solution sucks in the long-term.
Certainly does.

> 	- Reformat, and give the partition for OS X as much space as
I actually have a dedicated swap partition - I know you can debate the 
merits of this - but I'd rather fix this without having to reformat again.

Option three - play with the dynamic_pager settings in /etc/rc

Jaguar used these settings:
dynamic_pager -H 40000000 -L 160000000 -S 80000000 -F ${swapdir}/swapfile

Panther, in line 232 of /etc/rc has:
dynamic_pager -F ${swapdir}/swapfile

 From the man page, it seems dynamic_pager defaults to creating 
progressively larger swapfiles instead of having swap space fragmented 
between multiple 80mb chunks as it did with the -S 80000000 setting in 
jaguar. Also without high and low water mark set (-H and -L), 
dynamic_pager won't clean away any unused swap files.

So going back to my original post:
-rw------T   1 root  wheel        64M 25 Mar 15:59 swapfile0
-rw------T   1 root  wheel        64M 25 Mar 16:15 swapfile1
-rw------T   1 root  wheel       128M 25 Mar 16:41 swapfile2
-rw------T   1 root  wheel       256M 25 Mar 16:41 swapfile3
-rw------T   1 root  wheel       512M 25 Mar 22:07 swapfile4

As I understand this only the 512M swapfile4 was actually being used - 
had dynamic_pager had -h and -L set correctly it would have removed the 
other 512M worth of files, and would have been able to fit a 1024M file 
on my 2gig swap partition instead of warning me the disk was full (with 
400mb still to go) and telling me to quit applications.

So where does that leave us?
As I see it there 3 or 4 ways to go here, depending on whether you're 
using a dedicated swap partition or the main OSX disk, and how much disk 
space you have free.

Those using the default vm set up by Apple, would do well to add -H and 
-L options to ensure that disk space is freed up when not needed. 
Additionally if you have little space left on your disk it might be wise 
to set a -S option to make vm disk use a little more granular.

For myself with a 2gig swap partition and 512mb of RAM... It seems I 
could make dynamic_pager clean out my unused swap files by adding -H and 
-L options, thus increasing my maximum swapfile size to 1gig (in my 2 
gig partition), but that doesn't seem very efficient.
Alternatively I can set a swapfile size with -S. This would allow me to 
pretty much fill my 2gig swap space, and I don't really need -H and -L 
because it's a dedicated swap partition. The question is how big do I 
make the swapfiles? Is there any reason why I shouldn't just go for a 
partition filling 2gig swapfile right off? What advantage to I get by 
going for smaller sizes?

I'm going to experiment with some of this right now, but I'm interested 
in peoples thoughts on the latter point.

Adrian







More information about the X-Unix mailing list