Sono su High Sierra su MacBook Pro con 16 GB di RAM con SSD.
Hai 15G di file di scambio, esiste un metodo per liberare spazio / file di scambio senza riavviare?
$ sysctl -a | grep swap
vm.swapusage: total = 15360.00M used = 14468.75M free = 891.25M (encrypted)
vm.compressor_swapout_target_age: 0
vm.swapfileprefix: /private/var/vm/swapfile
debug.intel.swapCount: 0
$ ll -h /var/vm/swap*
-rw------- 1 root wheel 1.0G Apr 30 16:10 /var/vm/swapfile0
-rw------- 1 root wheel 1.0G Apr 30 17:16 /var/vm/swapfile1
-rw------- 1 root wheel 1.0G May 11 21:28 /var/vm/swapfile10
-rw------- 1 root wheel 1.0G May 11 21:46 /var/vm/swapfile11
-rw------- 1 root wheel 1.0G May 11 22:04 /var/vm/swapfile12
-rw------- 1 root wheel 1.0G May 11 23:00 /var/vm/swapfile13
-rw------- 1 root wheel 1.0G May 11 23:01 /var/vm/swapfile14
-rw------- 1 root wheel 1.0G May 11 23:02 /var/vm/swapfile15
-rw------- 1 root wheel 1.0G May 2 12:45 /var/vm/swapfile2
-rw------- 1 root wheel 1.0G May 4 14:02 /var/vm/swapfile3
-rw------- 1 root wheel 1.0G May 4 05:50 /var/vm/swapfile4
-rw------- 1 root wheel 1.0G May 8 11:05 /var/vm/swapfile5
-rw------- 1 root wheel 1.0G May 9 16:18 /var/vm/swapfile6
-rw------- 1 root wheel 1.0G May 10 03:02 /var/vm/swapfile7
-rw------- 1 root wheel 1.0G May 11 13:03 /var/vm/swapfile8
-rw------- 1 root wheel 1.0G May 11 21:07 /var/vm/swapfile9
Mi piacerebbe in qualche modo rilasciare questi file senza disattivare dynamic_pager
.
Ho provato a:
- esegui
sudo purge
(forza la cache del disco da eliminare); - esci da tutte le app che non sto utilizzando;
-
prendi in giro il sistema creando file di scambio fittizi prima che vengano creati:
cd /var/vm sudo touch swapfile{0..20} 2>/dev/null; sudo chmod 000 swapfile{0..20} 2>/dev/null
ma non ha funzionato, poiché il sistema crea / modifica i file nonostante i permessi di
000
, strano.
Per qualche ragione, htop
mostra la memoria virtuale come 532G, ma credo che sia un bug, dato che top
sta mostrando meno usato.
Soprahtop
/top
mostrasolo2attivitàinesecuzione,445stannodormendo,laCPUnonèutilizzatamolto,mailkernelèoccupatoconloswappingtra15Gdifile.
Potreiriavviarlomadopoalcunigiorniquestoproblemasiripeteognisettimana.Idealmente,mipiacerebbeuccidereedistruggere(rimuovere)ifilediswapericominciarenellastessasessione,mamacOSnonmipermettedifarlo.
$sudorm-frswapfile*Password:rm:cannotremove'swapfile0':Operationnotpermitted
Sonodisponibilialcunihackperforzaredynamic_pager
arilasciarequestifile?Nonhobisognodicosìtanto.
Btw.Questifilediscambiosonovuoti!Vedi:
$sudostringsswapfile*swapfile0swapfile1swapfile10swapfile11swapfile12swapfile13swapfile2swapfile3swapfile4swapfile5swapfile6swapfile7swapfile8swapfile9/var/vm$sudogzipswapfile*/var/vm$ll-h*.gz-rw-------1rootwheel1.6MApr3016:10swapfile0.gz-rw-------1rootwheel1.6MApr3017:16swapfile1.gz-rw-------1rootwheel1.6MMay1121:28swapfile10.gz-rw-------1rootwheel1.6MMay1121:46swapfile11.gz-rw-------1rootwheel1.6MMay1122:04swapfile12.gz-rw-------1rootwheel1.6MMay1123:00swapfile13.gz-rw-------1rootwheel1.6MMay212:45swapfile2.gz-rw-------1rootwheel1.6MMay414:02swapfile3.gz-rw-------1rootwheel1.6MMay405:50swapfile4.gz-rw-------1rootwheel1.6MMay811:05swapfile5.gz-rw-------1rootwheel1.6MMay916:18swapfile6.gz-rw-------1rootwheel1.6MMay1003:02swapfile7.gz-rw-------1rootwheel1.6MMay1113:03swapfile8.gz-rw-------1rootwheel1.6MMay1121:07swapfile9.gz
Sequestisonovuoti,perchémacOSnonpuòsemplicementerimuoverli.Sonoabbastanzasicurochelamialentezzadelsistema(comecaricareavgeincluderespessoilcongelamentodelmouse)siacausatadaquestacostantecreazioneerimozionediquestifile,poichénonhoaltriprocessicheutilizzanomoltolamiaCPU.
Adesempio,primadiscriverequestopost,hoavuto13Gdifilediswap(1Gciascuno),durantelascritturael'incollamentosopral'outputhofinitocon15G(facendoquasinulla),quindimacOSeffettivamenterimossoswapfile14
eswapfile15
(quindi13Gdiswap)quandosiscrivequesto.Quindirimossoswapfile13
durantelascritturadiquestafrase.Quindicreatofinoaswapfile16
(16G)durantelascritturadiquestafrase.Erimossonuovamenteswapfile16
durantelascritturadiquestafrase.Ecosìvia.Checasino.Sequestisonofilevuoti,perchémacOScontinuaacrearli,quandononhariempitonullalìdentro.
Altreinformazioni:
$sudolaunchctllist|greppager-0com.apple.dynamic_pager$launchctlprintsystem|grepdynamic_pager00com.apple.dynamic_pager$pswuax|grepdynamic_pager#Norunning?!$launchctldumpstate|grep-A20com.apple.dynamic_pager00com.apple.dynamic_pager--com.apple.dynamic_pager={activecount=0path=/System/Library/LaunchDaemons/com.apple.dynamic_pager.pliststate=waitingprogram=/sbin/dynamic_pagerarguments={/sbin/dynamic_pager}defaultenvironment={PATH=>/usr/bin:/bin:/usr/sbin:/sbin}environment={XPC_SERVICE_NAME=>com.apple.dynamic_pager}domain=com.apple.xpc.launchd.domain.systemminimumruntime=10exittimeout=5runs=1successivecrashes=0excessivecrashing=0lastexitcode=0
Eccouncampionedi1secondodelprocessoWindowServer
,incuièstatospesoalmenounmezzosecondoperloscambio:
Command:WindowServerParent:launchd[1]Duration:1.01sSteps:10(100mssamplinginterval)Activecpus:8Fanspeed:2159rpmThread0x1abThreadname"VM_cswap_trigger" 10 samples (1-10) priority 91 (base 91) cpu time 0.222s
<IO tier 0>
*10 call_continuation + 23 (kernel + 2098423) [0xffffff80004004f7] 1-10
*10 ??? (kernel + 2882629) [0xffffff80004bfc45] 1-10
*6 ??? (kernel + 2883102) [0xffffff80004bfe1e] 1-6
*6 thread_block_reason + 175 (kernel + 2530911) [0xffffff8000469e5f] 1-6
*6 ??? (kernel + 2534903) [0xffffff800046adf7] 1-6
*6 machine_switch_context + 205 (kernel + 3578125) [0xffffff800056990d] 1-6
*1 ??? (kernel + 2883122) [0xffffff80004bfe32] 7
*1 ??? (kernel + 2885317) [0xffffff80004c06c5] 7
*1 c_seg_do_minor_compaction_and_unlock + 303 (kernel + 2886351) [0xffffff80004c0acf] 7
*1 c_seg_minor_compaction_and_unlock + 344 (kernel + 2887576) [0xffffff80004c0f98] (running) 7
*2 ??? (kernel + 2883102) [0xffffff80004bfe1e] 8-9
*2 thread_block_reason + 175 (kernel + 2530911) [0xffffff8000469e5f] 8-9
*2 ??? (kernel + 2534903) [0xffffff800046adf7] 8-9
*2 machine_switch_context + 205 (kernel + 3578125) [0xffffff800056990d] 8-9
*1 ??? (kernel + 2883122) [0xffffff80004bfe32] 10
*1 ??? (kernel + 2885317) [0xffffff80004c06c5] 10
*1 c_seg_do_minor_compaction_and_unlock + 303 (kernel + 2886351) [0xffffff80004c0acf] 10
*1 c_seg_minor_compaction_and_unlock + 633 (kernel + 2887865) [0xffffff80004c10b9] 10
*1 kernel_memory_depopulate + 194 (kernel + 2976354) [0xffffff80004d6a62] 10
*1 pmap_remove_options + 1124 (kernel + 3488404) [0xffffff8000553a94] 10
*1 pmap_remove_range_options + 1988 (kernel + 3485812) [0xffffff8000553074] (running) 10
Thread 0x1ac Thread name "VM_compressor" 10 samples (1-10) priority 91 (base 91) cpu time 0.201s
<IO tier 0>
*6 call_continuation + 23 (kernel + 2098423) [0xffffff80004004f7] 1-6
*6 vm_pageout_iothread_internal_continue + 1129 (kernel + 3134345) [0xffffff80004fd389] 1-6
*6 vm_pageout_compress_page + 268 (kernel + 3135052) [0xffffff80004fd64c] 1-6
*6 vm_compressor_pager_put + 160 (kernel + 2903904) [0xffffff80004c4f60] 1-6
*6 vm_compressor_put + 1389 (kernel + 2900045) [0xffffff80004c404d] 1-6
*1 WKdm_compress_new + 736 (kernel + 2092960) [0xffffff80003fefa0] (running) 1
*1 WKdm_compress_new + 776 (kernel + 2093000) [0xffffff80003fefc8] (running) 2
*1 WKdm_compress_new + 781 (kernel + 2093005) [0xffffff80003fefcd] (running) 3
*1 WKdm_compress_new + 303 (kernel + 2092527) [0xffffff80003fedef] (running) 4
*1 WKdm_compress_new + 748 (kernel + 2092972) [0xffffff80003fefac] (running) 5
*1 WKdm_compress_new + 771 (kernel + 2092995) [0xffffff80003fefc3] (running) 6
*1 vm_pageout_iothread_internal_continue + 0 (kernel + 3133216) [0xffffff80004fcf20] 7
*1 call_continuation + 23 (kernel + 2098423) [0xffffff80004004f7] 8
*1 vm_pageout_iothread_internal_continue + 1129 (kernel + 3134345) [0xffffff80004fd389] 8
*1 vm_pageout_compress_page + 268 (kernel + 3135052) [0xffffff80004fd64c] 8
*1 vm_compressor_pager_put + 127 (kernel + 2903871) [0xffffff80004c4f3f] (running) 8
*2 vm_pageout_iothread_internal_continue + 0 (kernel + 3133216) [0xffffff80004fcf20] 9-10
Thread 0x1ad Thread name "VM_compressor" 10 samples (1-10) priority 91 (base 91) cpu time 0.144s
<IO tier 0>
*3 call_continuation + 23 (kernel + 2098423) [0xffffff80004004f7] 1-3
*3 vm_pageout_iothread_internal_continue + 1129 (kernel + 3134345) [0xffffff80004fd389] 1-3
*3 vm_pageout_compress_page + 268 (kernel + 3135052) [0xffffff80004fd64c] 1-3
*3 vm_compressor_pager_put + 160 (kernel + 2903904) [0xffffff80004c4f60] 1-3
*3 vm_compressor_put + 1389 (kernel + 2900045) [0xffffff80004c404d] 1-3
*1 WKdm_compress_new + 280 (kernel + 2092504) [0xffffff80003fedd8] (running) 1
*1 WKdm_compress_new + 286 (kernel + 2092510) [0xffffff80003fedde] (running) 2
*1 WKdm_compress_new + 309 (kernel + 2092533) [0xffffff80003fedf5] (running) 3
*1 vm_pageout_iothread_internal_continue + 0 (kernel + 3133216) [0xffffff80004fcf20] 4
*2 call_continuation + 23 (kernel + 2098423) [0xffffff80004004f7] 5-6
*1 vm_pageout_iothread_internal_continue + 1187 (kernel + 3134403) [0xffffff80004fd3c3] 5
*1 vm_page_free_list + 124 (kernel + 3219628) [0xffffff80005120ac] 5
*1 vm_page_free_prepare_object + 146 (kernel + 3207826) [0xffffff800050f292] (running) 5
*1 vm_pageout_iothread_internal_continue + 1129 (kernel + 3134345) [0xffffff80004fd389] 6
*1 vm_pageout_compress_page + 304 (kernel + 3135088) [0xffffff80004fd670] (running) 6
*4 vm_pageout_iothread_internal_continue + 0 (kernel + 3133216) [0xffffff80004fcf20] 7-10