package main
import ( "runtime" _ "net/http/pprof" "net/http" "time" ) var ch = make(chan struct{},1) func printMem() { var mem runtime.MemStats runtime.ReadMemStats(&mem) println(mem.HeapObjects) } func easy() { <-ch } func bussy() { sum := 0 for i:=0;i<1000;i++ { for j:=0;j<10000*100000;j++ { sum++ } time.Sleep(time.Duration(100+i/10)*time.Millisecond) } } func main() { for i:=0;i<1;i++ { //go easy() go bussy() } ticker := time.NewTicker(3*time.Second) for range ticker.C { runtime.GC() } http.ListenAndServe(":9090",nil) } gc 1 @3.007s 0%: 195+0.26+0.025 ms clock, 587+0/0.21/0.44+0.077 ms cpu, 1->1->0 MB, 4 MB goal, 4 P (forced) gc 2 @6.006s 0%: 0.065+0.82+0.041 ms clock, 0.26+0/0.71/0.51+0.16 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 3 @9.005s 0%: 242+0.32+0.016 ms clock, 971+0/0.045/0.36+0.064 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 4 @12.005s 0%: 0.010+0.37+0.039 ms clock, 0.040+0/0.32/0.68+0.15 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 5 @15.004s 0%: 233+0.33+0.014 ms clock, 932+0/0.050/0.36+0.059 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 6 @18.006s 0%: 0.016+0.19+0.016 ms clock, 0.064+0/0.16/0.33+0.066 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 7 @21.003s 0%: 276+0.30+0.049 ms clock, 1104+0/0.044/0.33+0.19 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 8 @24.002s 0%: 52+0.23+0.019 ms clock, 211+0/0.20/0.37+0.076 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 9 @27.002s 0%: 270+0.23+0.013 ms clock, 1080+0/0.21/0.37+0.053 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 10 @30.002s 0%: 59+0.48+0.029 ms clock, 239+0/0.44/0.10+0.11 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 11 @33.002s 0%: 339+0.32+0.014 ms clock, 1356+0/0.29/0.44+0.058 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 12 @36.004s 0%: 286+0.45+0.038 ms clock, 1145+0/0.40/0.13+0.15 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 13 @39.006s 0%: 123+0.38+0.023 ms clock, 493+0/0.36/0.66+0.094 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 14 @42.005s 0%: 0.016+0.26+0.015 ms clock, 0.064+0/0.25/0.41+0.062 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 15 @45.005s 0%: 278+0.33+0.020 ms clock, 1113+0/0.29/0.28+0.082 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 16 @48.004s 0%: 128+0.22+0.039 ms clock, 514+0/0.13/0.40+0.15 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 17 @51.004s 0%: 0.014+0.34+0.020 ms clock, 0.056+0/0.053/0.39+0.081 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 18 @54.006s 0%: 331+0.23+0.017 ms clock, 1325+0/0.19/0.35+0.070 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 19 @57.002s 0%: 179+0.30+0.017 ms clock, 717+0/0.044/0.32+0.068 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) gc 20 @60.004s 0%: 0.009+0.47+0.033 ms clock, 0.038+0/0.36/0.77+0.13 ms cpu, 0->0->0 MB, 4 MB goal, 4 P (forced) version golang 1.9.2 I doubt the gc time: STW1=>Mark=>STW2 the long time cal goroutine make the STW1 long time but why the STW2 also need stop the world and the time is little ?? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.