github.com/razvanm/vanadium-go-1.3@v0.0.0-20160721203343-4a65068e5915/test/gc.go (about)

     1  // run
     2  
     3  // Copyright 2009 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Simple test of the garbage collector.
     8  
     9  package main
    10  
    11  import "runtime"
    12  
    13  func mk2() {
    14  	b := new([10000]byte)
    15  	_ = b
    16  	//	println(b, "stored at", &b)
    17  }
    18  
    19  func mk1() { mk2() }
    20  
    21  func main() {
    22  	for i := 0; i < 10; i++ {
    23  		mk1()
    24  		runtime.GC()
    25  	}
    26  }