funcinitMap() { for i := 0; i < cnt; i++ { m[i] = i } }
funcdelMap() { for i := 0; i < cnt; i++ { delete(m, i) } }
funcmemStatus() { var m runtime.MemStats runtime.ReadMemStats(&m) // Alloc is bytes of allocated heap objects.
// TotalAlloc is cumulative bytes allocated for heap objects. // Sys is the total bytes of memory obtained from the OS. // NumGC is the number of completed GC cycles. log.Printf("Alloc: %v, TotalAlloc: %v, Sys: %v, NumGC: %v", m.Alloc/1024, m.TotalAlloc/1024, m.Sys/1024, m.NumGC) }