Skip to content

Instantly share code, notes, and snippets.

@mirtchovski
Last active December 25, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirtchovski/6905198 to your computer and use it in GitHub Desktop.
Save mirtchovski/6905198 to your computer and use it in GitHub Desktop.
OSX, memory available
PhysMem: 1894M wired, 502M active, 31M inactive, 2428M used, 14G free.
$ ./t
Used memory after creating 1000000 blocked goroutines:
Allocs: 296599656 bytes
HeapAlloc: 296599656 bytes
Sys mem: 4521417976 bytes
NumGC: 3
After running 1000000 goroutines got 1000000 as result
Spawn time: 9.582249993s; read from channel time: 402.042346ms
Remaining goroutines: 973272
Remaining goroutines after sleep: 3
Used memory after freeing 1000000 blocked goroutines:
Allocs: 296600136 bytes
HeapAlloc: 296600136 bytes
Sys mem: 4521417976 bytes
NumGC: 4
$ ./t2
Used memory after creating 1000000 blocked goroutines:
Allocs: 296575080 bytes
HeapAlloc: 296575080 bytes
Sys mem: 8584191224 bytes
NumGC: 3
After running 1000000 goroutines got 1000000 as result
Spawn time: 11.971272878s; read from channel time: 402.469094ms
Remaining goroutines: 966732
Remaining goroutines after sleep: 3
Used memory after freeing 1000000 blocked goroutines:
Allocs: 296575560 bytes
HeapAlloc: 296575560 bytes
Sys mem: 8584191224 bytes
NumGC: 4
----------------------
OSX, only some memory available:
PhysMem: 1247M wired, 1009M active, 637M inactive, 2893M used, 5290M free.
$ ./t
Used memory after creating 1000000 blocked goroutines:
Allocs: 296601416 bytes
HeapAlloc: 296601416 bytes
Sys mem: 4521417976 bytes
NumGC: 3
After running 1000000 goroutines got 1000000 as result
Spawn time: 10.07496231s; read from channel time: 373.904943ms
Remaining goroutines: 971592
Remaining goroutines after sleep: 3
Used memory after freeing 1000000 blocked goroutines:
Allocs: 296601976 bytes
HeapAlloc: 296601976 bytes
Sys mem: 4521417976 bytes
NumGC: 4
$ ./t2
Used memory after creating 1000000 blocked goroutines:
Allocs: 296576840 bytes
HeapAlloc: 296576840 bytes
Sys mem: 8584191224 bytes
NumGC: 3
After running 1000000 goroutines got 1000000 as result
Spawn time: 16.128605079s; read from channel time: 391.379706ms
Remaining goroutines: 954792
Remaining goroutines after sleep: 3
Used memory after freeing 1000000 blocked goroutines:
Allocs: 296577400 bytes
HeapAlloc: 296577400 bytes
Sys mem: 8584191224 bytes
NumGC: 4
----------------
Linux, plenty of memory available:
$ ./t
Used memory after creating 1000000 blocked goroutines:
Allocs: 296601400 bytes
HeapAlloc: 296601400 bytes
Sys mem: 4521417976 bytes
NumGC: 3
After running 1000000 goroutines got 1000000 as result
Spawn time: 1.824038934s; read from channel time: 508.524358ms
Remaining goroutines: 993792
Remaining goroutines after sleep: 3
Used memory after freeing 1000000 blocked goroutines:
Allocs: 296601960 bytes
HeapAlloc: 296601960 bytes
Sys mem: 4521417976 bytes
NumGC: 4
$ ./t2
Used memory after creating 1000000 blocked goroutines:
Allocs: 296576824 bytes
HeapAlloc: 296576824 bytes
Sys mem: 8584191224 bytes
NumGC: 3
After running 1000000 goroutines got 1000000 as result
Spawn time: 1.908597731s; read from channel time: 526.184396ms
Remaining goroutines: 993492
Remaining goroutines after sleep: 3
Used memory after freeing 1000000 blocked goroutines:
Allocs: 296577384 bytes
HeapAlloc: 296577384 bytes
Sys mem: 8584191224 bytes
NumGC: 4
-------------------------
vm_stat for the low-mem run on osx:
Mach Virtual Memory Statistics: (page size of 4096 bytes, cache hits 0%)
free active spec inactive wire faults copy 0fill reactive pageins pageout
1174K 303566 140058 162452 314898 71489210 1379768 57342158 562507 1828639 294023
1174K 303168 140058 162389 315786 1449 1 826 0 8 0
1173K 303061 140063 162386 315787 915 0 610 0 1 0
939561 536313 140063 162383 316440 233516 54 233158 0 0 0
833877 641440 140063 162380 317212 106558 0 106041 0 0 0
747990 727910 140062 162377 316503 85386 0 85316 0 1 0
678098 797115 140062 162377 317535 70818 0 70507 0 0 0
613612 860625 140062 162377 317957 63572 0 63530 0 0 0
557527 916371 140062 162377 318333 56754 0 56453 0 0 0
505964 967619 140066 162377 318659 51426 0 51372 0 7 0
458044 1015K 140067 162377 319030 49124 0 48799 0 1 0
410606 1062K 140066 162377 319397 47289 0 47208 0 1 0
365864 1107K 140065 162122 319111 45753 1 45482 0 1 0
321506 1150K 140064 162122 320019 44027 0 43925 0 1 0
279155 1192K 140064 162122 320345 42959 0 42687 0 0 0
237950 1233K 140064 162120 320658 41287 0 41192 0 0 0
198114 1273K 140064 162120 320959 40490 0 40031 0 0 0
158931 1312K 140064 162120 321250 39086 0 39002 0 0 0
122228 1348K 140060 162120 321577 37842 0 37418 0 6 0
88331 1382K 140070 162119 321837 36039 34 34143 0 7 0
54404 1417K 140071 162057 322088 35251 0 34902 0 3 0
Mach Virtual Memory Statistics: (page size of 4096 bytes, cache hits 0%)
free active spec inactive wire faults copy 0fill reactive pageins pageout
21441 1449K 140070 162057 321751 72653634 1379858 58499147 562507 1828677 294023
10934 1458K 140070 162057 323046 17650 0 17322 0 1 0
1170K 304155 140070 162041 318932 266 6 163 0 0 0
1169K 304040 140070 162041 318932 880 0 592 0 0 0
1169K 304703 140070 162041 318235 86 0 53 0 0 0
1170K 304795 140070 162041 318235 982 0 698 0 0 0
1170K 304684 140070 162041 318235 63 0 27 0 0 0
1170K 304844 140070 162041 318043 871 0 589 0 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment