Skip to content

Commit

Permalink
GC pauses be gone
Browse files Browse the repository at this point in the history
  • Loading branch information
tidwall committed Sep 4, 2019
1 parent 2571ce5 commit 3d96b17
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/server/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ func readMemStats() runtime.MemStats {
if !memStatsBG {
runtime.ReadMemStats(&memStats)
go func() {
var ms runtime.MemStats
for {
runtime.ReadMemStats(&ms)
memStatsMu.Lock()
runtime.ReadMemStats(&memStats)
memStats = ms
memStatsMu.Unlock()
time.Sleep(time.Second / 5)
}
Expand Down

0 comments on commit 3d96b17

Please sign in to comment.