Add memory leak tests using the snippets in #257 as a starting point.
These take the form of benchmarks that fail on excessive memory usage (determined by an environment variable MEM_THRESHOLD), which makes detection simple (just run go test -bench) and investigation straightforward using standard Go profiling tools:
go test -bench=Leak/select -memprofile leak.prof
go tool pprof gojq.test leak.prof
Additionally, make test now also runs these tests so that memory leaks can be found by CI. See the failing checks below for details.
Add memory leak tests using the snippets in #257 as a starting point.
These take the form of benchmarks that fail on excessive memory usage (determined by an environment variable
MEM_THRESHOLD
), which makes detection simple (just rungo test -bench
) and investigation straightforward using standard Go profiling tools:Additionally,
make test
now also runs these tests so that memory leaks can be found by CI. See the failing checks below for details.