Source file test/gc.go

     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  }
    27  

View as plain text