summaryrefslogtreecommitdiff
path: root/test/gc.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-01-26 17:37:05 -0800
committerRuss Cox <rsc@golang.org>2009-01-26 17:37:05 -0800
commitc1b08d0dc7c14503a310801b4e48571a735ea718 (patch)
tree716e6b85c74f50ceb20e1aa0bd630654b5c13e17 /test/gc.go
parent1bb0156bec3e5202ee0259e5c049c85ee076c669 (diff)
downloadgo-c1b08d0dc7c14503a310801b4e48571a735ea718.tar.gz
gc #0. mark and sweep collector.
R=r,gri DELTA=472 (423 added, 2 deleted, 47 changed) OCL=23522 CL=23541
Diffstat (limited to 'test/gc.go')
-rw-r--r--test/gc.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/gc.go b/test/gc.go
new file mode 100644
index 000000000..df9d05e18
--- /dev/null
+++ b/test/gc.go
@@ -0,0 +1,25 @@
+// $G $F.go && $L $F.$A && ./$A.out
+
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "malloc"
+
+func mk2() {
+ b := new([10000]byte);
+// println(b, "stored at", &b);
+}
+
+func mk1() {
+ mk2();
+}
+
+func main() {
+ for i := 0; i < 10; i++ {
+ mk1();
+ malloc.GC();
+ }
+}