Why does my macOS always swap while sleeping? Firstly, I had disabled swapping and hibernatemode is set to 0 

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
sudo pmset -a hibernatemode 0


(macOS SIP was disabled when executing the commands above)

Secondly, I use fs_usage to monitor fs usage log when sleep

sudo fs_usage -w &gt;fsusage.log


sleep time is about 8 hours. 

What I'm looking for is that the Mac will sleep, and just sleep, doing nothing. But I got a 135M fsusage.log file, and when I analyzed the log file, I got some weird results.

Here is the analysis result:


The Mac always awake in certain periods of time.
The system doesn't swapping when normal use, but swapping when sleep.


The most written CALL

PgOut[ST1P] : 3726 (MB)

The PgOut[ST1P] CALL  write to the files:  

/dev/disk1  /private/var/vm/swapfile0 : 2443 (MB)
/dev/disk1  /private/var/vm/swapfile1 : 1282 (MB)




PgOut size by timestamp:

05:55 : 1316 (MB)
06:56 : 1004 (MB)
07:12 : 143 (MB)
08:45 : 620 (MB)
08:46 : 25 (MB)
08:50 : 452 (MB)
08:51 : 163 (MB)

Sleep time is from 01:06 to 08:51

My MBP information:
MacBook Pro (13-inch, 2017)
macOS version: 10.12.6
memory size: 16GB
csrutil enable will cause swapping mode reopen.

edit /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist file to disable it;



then restart the SIP mode.
Disable standby, autopoweroff, ttyskeepawake, tcpkeepalive in pmset:

pmset -a standby 0
pmset -a autopoweroff 0
pmset -a ttyskeepawake 0
pmset -a tcpkeepalive 0