aboutsummaryrefslogtreecommitdiff
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
commit1ce17918e32afe42824404a1419b54a465e8b155 (patch)
tree716e6b85c74f50ceb20e1aa0bd630654b5c13e17 /test/gc.go
parent5b129cda5f53aa217203a24bd44936092668c154 (diff)
downloadgo-1ce17918e32afe42824404a1419b54a465e8b155.tar.gz
go-1ce17918e32afe42824404a1419b54a465e8b155.zip
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 0000000000..df9d05e187
--- /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();
+ }
+}