go/test/malloc1.go
Russ Cox 226fb099d9 runtime: add UpdateMemStats, use in tests
Drops mallocrep1.go back to a reasonable
amount of time.  (154 -> 0.8 seconds on my Mac)

Fixes #2085.

R=golang-dev, dvyukov, r
CC=golang-dev
https://golang.org/cl/4811045
2011-07-22 00:55:01 -04:00

26 lines
467 B
Go

// $G $D/$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.
// trivial malloc test
package main
import (
"flag"
"fmt"
"runtime"
)
var chatty = flag.Bool("v", false, "chatty")
func main() {
runtime.Free(runtime.Alloc(1))
runtime.UpdateMemStats()
if *chatty {
fmt.Printf("%+v %v\n", runtime.MemStats, uint64(0))
}
}