From 859c13a5ad80308125c79521cfc047200fd5a512 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Tue, 14 Nov 2023 15:36:39 +0000 Subject: [PATCH] internal/trace/v2: halve the memory footprint of the gc-stress test 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Pratt --- src/internal/trace/v2/testdata/testprog/gc-stress.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/internal/trace/v2/testdata/testprog/gc-stress.go b/src/internal/trace/v2/testdata/testprog/gc-stress.go index 7a1fdfdfe1..70d3a246c3 100644 --- a/src/internal/trace/v2/testdata/testprog/gc-stress.go +++ b/src/internal/trace/v2/testdata/testprog/gc-stress.go @@ -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)) } }() } -- 2.44.0