]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: relax TestMemoryLimitNoGCPercent a bit
authorKeith Randall <khr@golang.org>
Mon, 21 Jul 2025 20:37:27 +0000 (13:37 -0700)
committerKeith Randall <khr@golang.org>
Tue, 22 Jul 2025 00:54:26 +0000 (17:54 -0700)
It seems to be pretty flaky. I've seen:

retained=289438024
   limit=268435456
   bound=285212672

Which is ~4MB over the bound.

Not sure why this tends to be darwin-specific, but we'll fix
just darwin for now.
(It isn't quite darwin-only, as it appeared in #66893.
But it is certainly worse on darwin.)

Fixes #73136
Update #66893

Change-Id: If609e909bc6c65c2663dd46b7a9bad4fd291c3da
Reviewed-on: https://go-review.googlesource.com/c/go/+/689315
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/runtime/testdata/testprog/gc.go

index 5dc85fbb6247c54f48e06f959b4c47484f12d853..bbe1453401325f8efcca14951c11ad5eb3bbf367 100644 (file)
@@ -395,6 +395,9 @@ func gcMemoryLimit(gcPercent int) {
                // somewhat heavily here) this bound is kept loose. In practice the Go runtime
                // should do considerably better than this bound.
                bound := int64(myLimit + 16<<20)
+               if runtime.GOOS == "darwin" {
+                       bound += 16 << 20 // Be more lax on Darwin, see issue 73136.
+               }
                start := time.Now()
                for time.Since(start) < 200*time.Millisecond {
                        metrics.Read(m[:])