From 46bef40bc6e6ffc88df7d8c4af542c1075e492ed Mon Sep 17 00:00:00 2001 From: Moses Narrow <36607567+0pcom@users.noreply.github.com> Date: Thu, 13 Aug 2026 20:26:19 -0500 Subject: [PATCH] runtime: add MemStats.NumGC for API compatibility TinyGo's GC does not count cycles, so this stays 0 and says so. It exists because reading runtime.MemStats.NumGC is common enough in dependency code that its absence is a compile error for programs that never look at the value. --- src/runtime/mstats.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/runtime/mstats.go b/src/runtime/mstats.go index 987e17c30c..d6395cbf90 100644 --- a/src/runtime/mstats.go +++ b/src/runtime/mstats.go @@ -82,4 +82,10 @@ type MemStats struct { // GCSys is bytes of memory in garbage collection metadata. GCSys uint64 + + // NumGC is the number of completed GC cycles. + // + // TinyGo does not track GC cycle counts; present for API compatibility so + // callers that read runtime.MemStats.NumGC compile (it stays 0). + NumGC uint32 }