Mac virtual memory: how to make OS X create swap (page) files as freely with a normal boot as it does with a safe boot (swapfile1 etc)

Solution 1:

AFAIK the reason all those swap files were created so quickly in Safe Mode is because dynamic_pager fell back to an initial swap size of 64MB. How many swap files did you see? How many do you want to see? How many are you seeing?

Right now on my Mac Pro (desktop) running OS 10.8.3 I have 7 swap files (numbered 0-6). Is that what you want? Actually, since you've pointed this out, I'm going to try to reduce that to 2.

If you really want to create a lot of swap files, just set -S 67108864

BTW, 1073741824 = 2^30 = 1 GiB

Followup

Turns out there is a bug in dynamic_pager (at least under Mountain Lion 10.8.4) where setting -S 2147483648 (= 2 GiB) fails because of some sort of 32-bit conversion error.

Cannot extend paging file size /private/var/vm/swapfile0 to 18446744071562067968!

2147483648 as a 32 bit signed in is actually -2147483648 or 0x80000000 which gets extended to a 64 bit number by extending the MSB and turned into 0xFFFFFFFF80000000 which is then converted to a 64 bit unsigned which is 18446744071562067968 or 2 GiB * 8 GiB. Crazy. So after you mess with the dynamic pager options, look for error messages in the console logs.