summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/gc_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/gc_test.go')
-rw-r--r--src/pkg/runtime/gc_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pkg/runtime/gc_test.go b/src/pkg/runtime/gc_test.go
index e1e1b1d01..3475339bf 100644
--- a/src/pkg/runtime/gc_test.go
+++ b/src/pkg/runtime/gc_test.go
@@ -7,6 +7,7 @@ package runtime_test
import (
"os"
"runtime"
+ "runtime/debug"
"testing"
)
@@ -82,3 +83,17 @@ func TestGcDeepNesting(t *testing.T) {
t.Fail()
}
}
+
+func TestGcHashmapIndirection(t *testing.T) {
+ defer debug.SetGCPercent(debug.SetGCPercent(1))
+ runtime.GC()
+ type T struct {
+ a [256]int
+ }
+ m := make(map[T]T)
+ for i := 0; i < 2000; i++ {
+ var a T
+ a.a[0] = i
+ m[a] = T{}
+ }
+}