summaryrefslogtreecommitdiff
path: root/vendor/modernc.org/libc/mem_expvar.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/modernc.org/libc/mem_expvar.go')
-rw-r--r--vendor/modernc.org/libc/mem_expvar.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/vendor/modernc.org/libc/mem_expvar.go b/vendor/modernc.org/libc/mem_expvar.go
new file mode 100644
index 000000000..e2c5aae7a
--- /dev/null
+++ b/vendor/modernc.org/libc/mem_expvar.go
@@ -0,0 +1,12 @@
+//go:build libc.memexpvar
+
+package libc
+
+import "expvar"
+
+func init() {
+ // make sure to build with -tags=memory.counters to have the actual data accumulated in memory allocator
+ expvar.Publish("memory.allocator", expvar.Func(func() interface{} {
+ return MemStat()
+ }))
+}