Is possible set the minimum swapfile size in OS X?
Currently OS X allocating swapfiles on demand, e.g. when when need 3.2GB will allocate 4GB and so on. But when the swap requirements start getting low the system deletes un-needed swap files. All these IO operations are very IO intensive.
Therefore looking for a way how to define the minimum swap file size, e.g. I want default allocate minimum 4GB virtual memory. When the system will need more than 4GB will allocate on demand, but at releasing will never release under 4GB size.
Is this possible somewhat? (using lion)
Best Answer
dynamic_pager(8) Mac OS X Manual Page
With Terminal, a one-off command to convert a property list to a format that will be easily editable:
sudo plutil -convert xml1 com.apple.dynamic_pager.plist
Then if you're happy to edit with nano:
sudo nano /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
Use option
-S
to set a size in bytes, then save that property list and either:That's a single size for all files, and any use of option
-S
will causedynamic_pager
to not use variable sized paging files:Based on my tests with Mountain Lion, you might find that
dynamic_pager
will quietly fail to begin with a file that is so large.Proceed with caution – pay attention to the actual size of
swapfile0
and if it is zero bytes, then beware of inexplicable reductions to free space on the volume where the files are expected.Consider
dynamic_pager
option-L