From 4f7635b2166b6cab3cdf1b5f8c9a7cf305101dfe Mon Sep 17 00:00:00 2001 From: Patricio Whittingslow Date: Sat, 28 Feb 2026 16:37:36 -0300 Subject: [PATCH] debug: add free memory printing --- internal/debug.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/debug.go b/internal/debug.go index eef856d..caff18f 100644 --- a/internal/debug.go +++ b/internal/debug.go @@ -34,6 +34,7 @@ func LogAllocs(msg string) { print(" inc=", int64(memstats.TotalAlloc)-int64(lastAllocs)) print(" n=", int64(memstats.Mallocs)-int64(lastMallocs)) print(" heap=", memstats.HeapAlloc) + print(" free=", memstats.HeapSys-memstats.HeapInuse) print(" tot=", memstats.TotalAlloc) println() } else { @@ -42,6 +43,7 @@ func LogAllocs(msg string) { n += copyValueInt(allocbuf[n:], "inc", int64(memstats.TotalAlloc)-int64(lastAllocs)) n += copyValueInt(allocbuf[n:], "n", int64(memstats.Mallocs)-int64(lastMallocs)) n += copyValueUint(allocbuf[n:], "heap", memstats.HeapAlloc) + n += copyValueUint(allocbuf[n:], "free", memstats.HeapSys-memstats.HeapInuse) n += copyValueUint(allocbuf[n:], "tot", memstats.TotalAlloc) println(unsafe.String(&allocbuf[0], n)) }