github.com/higress-group/nottinygc@v0.0.0-20231101025119-e93c4c2f8520/gc2_test.go (about) 1 // Copyright wasilibs authors 2 // SPDX-License-Identifier: MIT 3 4 package nottinygc_test 5 6 import ( 7 "runtime" 8 "testing" 9 ) 10 11 // Some simple GC tests copied from Go 12 func mk2() { 13 b := new([10000]byte) 14 _ = b 15 // println(b, "stored at", &b) 16 } 17 18 func mk1() { mk2() } 19 20 func TestGC(t *testing.T) { 21 for i := 0; i < 10; i++ { 22 mk1() 23 runtime.GC() 24 } 25 } 26 27 func TestGC1(t *testing.T) { 28 for i := 0; i < 1e5; i++ { 29 x := new([100]byte) 30 _ = x 31 } 32 }