Add debug heap memory allocation
All checks were successful
Go Test / test (push) Successful in 1m49s
All checks were successful
Go Test / test (push) Successful in 1m49s
This commit is contained in:
parent
7146d1a883
commit
f243fc6831
@ -50,7 +50,17 @@ func goroutineTicker(stop <-chan struct{}) {
|
||||
case <-stop:
|
||||
return
|
||||
case <-ticker.C:
|
||||
fmt.Printf("Number of goroutines running: %d\n", runtime.NumGoroutine())
|
||||
debugLog()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func debugLog() {
|
||||
var memStats runtime.MemStats
|
||||
runtime.ReadMemStats(&memStats)
|
||||
|
||||
goroutines := runtime.NumGoroutine()
|
||||
|
||||
fmt.Printf("\nNumber of goroutines: %d\n", goroutines)
|
||||
fmt.Printf("Heap Allocated memory: %2f MB\n\n", float64(memStats.HeapAlloc)/(1024*1024))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user