MCPcopy
hub / github.com/perkeep/perkeep / startMemGoroutine

Function startMemGoroutine

pkg/client/android/androidx.go:353–372  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

351var memOnce sync.Once
352
353func startMemGoroutine() {
354 if !androidOutput {
355 return
356 }
357 go func() {
358 var ms runtime.MemStats
359 n := 0
360 for {
361 runtime.ReadMemStats(&ms)
362 statMemReleased.Set(int64(ms.HeapReleased))
363 statMemAlloc.Set(int64(ms.Alloc))
364 statMemRSS.Set(osutil.MemUsage())
365 time.Sleep(1 * time.Second)
366 n++
367 if n%5 == 0 {
368 debug.FreeOSMemory()
369 }
370 }
371 }()
372}

Callers

nothing calls this directly

Calls 2

MemUsageFunction · 0.92
SetMethod · 0.65

Tested by

no test coverage detected