-
Notifications
You must be signed in to change notification settings - Fork 273
Closed
Description
Describe the bug
It seems there is a leak when trying to generate schemas from certain structs!
To Reproduce
package main
import (
"fmt"
"runtime"
"time"
"github.com/modelcontextprotocol/go-sdk/jsonschema"
v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
)
func main() {
ticker := time.NewTicker(5 * time.Second)
go func() {
for range ticker.C {
var m runtime.MemStats
runtime.ReadMemStats(&m)
fmt.Printf("Alloc: %d KB, Sys: %d KB, NumGC: %d\n",
m.Alloc/1024, m.Sys/1024, m.NumGC)
}
}()
_, err := jsonschema.For[v1.Pipeline]()
if err != nil {
panic(err)
}
}Expected behavior
Generating the schema correctly!
Logs
❯ go run main.go
Alloc: 3126601 KB, Sys: 3275482 KB, NumGC: 13
Alloc: 6046591 KB, Sys: 6332210 KB, NumGC: 14
Alloc: 8992110 KB, Sys: 9524295 KB, NumGC: 15
Alloc: 12696764 KB, Sys: 13284884 KB, NumGC: 15
Alloc: 14358771 KB, Sys: 15591427 KB, NumGC: 16
signal: killed
Additional context
OS: Linux
Go version: 1.24.3
Deps:
github.com/modelcontextprotocol/go-sdk v0.0.0-20250630184440-2facfc6ffe0b
github.com/tektoncd/pipeline v1.1.0