… set the minimum swapfile size …
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:
- simply, safely, restart the Mac; or
- unload then load the daemon – but that may be risky (and I suspect that only a restart of the Mac will reap the potential benefits).
That's a single size for all files, and any use of option -S
will cause dynamic_pager
to not use variable sized paging files:
- we can not simply set a minimum – alone – amongst that set of variables.
… I want default allocate minimum 4GB …
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.
… at releasing will never release under 4GB size. …
Consider dynamic_pager
option -L
If there are more than low-water-trigger bytes free in the external paging files, the kernel will coalese in-use pages and signal dynamic_pager to discard an external paging file. Low-water-trigger must be greater than high-water-trigger + filesize.
Yes - the per process memory statistics and mach call counters mean the same thing as the system wide statistics.
Activity Monitor helps you break down which specific processes are making up the conglomerated statistics if you use the screens shown above. You may also find the sysdoagnose
command useful in probing how the various numbers all add up if you prefer a textual output as opposed to a combined graphical and textual one.
Best Answer
You can use
vm_stat
andsysctl
terminal commands. Although there was no straightforward way or documentation on how to extract the new attributes from these commands, we had to do some trial and error till we discovered the relations between parameters in the commands and the attribute we need to calculate.The Steps are as the following:
vm_stat
Sample output from
vm_stat
: