]> Cypherpunks.ru repositories - gostls13.git/commitdiff
internal/trace/v2: halve the memory footprint of the gc-stress test
authorMichael Anthony Knyszek <mknyszek@google.com>
Tue, 14 Nov 2023 15:36:39 +0000 (15:36 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 14 Nov 2023 16:07:26 +0000 (16:07 +0000)
An out-of-memory error in this test has been observed on 32-bit
platforms, so halve the memory footprint of the test. Also halve the
size of steady-state allocation rate in bytes. The end result should be
approximately the same GC CPU load but at half the memory usage.

Change-Id: I2c2d335da7dc4c5c58cb9d92b6e5a4ece55d24a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/542215
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/internal/trace/v2/testdata/testprog/gc-stress.go

index 7a1fdfdfe120cf92c324a1f268095d078e3b2475..70d3a246c397f46e8dfc3b9d7031fcc181a629b4 100644 (file)
@@ -37,15 +37,15 @@ func makeTree(depth int) *node {
        }
 }
 
-var trees [32]*node
-var ballast *[32]*[8192]*node
+var trees [16]*node
+var ballast *[16]*[8192]*node
 var sink []byte
 
 func main() {
        for i := range trees {
                trees[i] = makeTree(6)
        }
-       ballast = new([32]*[8192]*node)
+       ballast = new([16]*[8192]*node)
        for i := range ballast {
                ballast[i] = new([8192]*node)
                for j := range ballast[i] {
@@ -57,7 +57,7 @@ func main() {
        for i := 0; i < runtime.GOMAXPROCS(-1); i++ {
                go func() {
                        for {
-                               sink = make([]byte, rand.Intn(65536))
+                               sink = make([]byte, rand.Intn(32<<10))
                        }
                }()
        }