mem_expvar.go 273 B

123456789101112
  1. //go:build libc.memexpvar
  2. package libc
  3. import "expvar"
  4. func init() {
  5. // make sure to build with -tags=memory.counters to have the actual data accumulated in memory allocator
  6. expvar.Publish("memory.allocator", expvar.Func(func() interface{} {
  7. return MemStat()
  8. }))
  9. }