summaryrefslogtreecommitdiff
path: root/libgo/go/runtime/gc_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/runtime/gc_test.go')
-rw-r--r--libgo/go/runtime/gc_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/libgo/go/runtime/gc_test.go b/libgo/go/runtime/gc_test.go
index 71d46561e03..11035c321ab 100644
--- a/libgo/go/runtime/gc_test.go
+++ b/libgo/go/runtime/gc_test.go
@@ -477,4 +477,21 @@ func testIfaceEqual(x interface{}) {
}
}
+func TestPageAccounting(t *testing.T) {
+ // Grow the heap in small increments. This used to drop the
+ // pages-in-use count below zero because of a rounding
+ // mismatch (golang.org/issue/15022).
+ const blockSize = 64 << 10
+ blocks := make([]*[blockSize]byte, (64<<20)/blockSize)
+ for i := range blocks {
+ blocks[i] = new([blockSize]byte)
+ }
+
+ // Check that the running page count matches reality.
+ pagesInUse, counted := runtime.CountPagesInUse()
+ if pagesInUse != counted {
+ t.Fatalf("mheap_.pagesInUse is %d, but direct count is %d", pagesInUse, counted)
+ }
+}
+
*/