mirror of
https://github.com/golang/go
synced 2024-11-23 00:40:08 -07:00
75647d2024
R=r DELTA=756 (754 added, 0 deleted, 2 changed) OCL=19266 CL=19378
38 lines
665 B
Go
38 lines
665 B
Go
// 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 (
|
|
"allocator"
|
|
)
|
|
|
|
var footprint int64
|
|
func bigger() {
|
|
if footprint < allocator.footprint {
|
|
footprint = allocator.footprint;
|
|
println("Footprint", footprint);
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
for i := 0; i < 1<<16; i++ {
|
|
for j := 1; j <= 1<<22; j<<=1 {
|
|
if i == 0 {
|
|
println("First alloc:", j);
|
|
}
|
|
b := allocator.malloc(j);
|
|
allocator.free(b);
|
|
bigger();
|
|
}
|
|
if i%(1<<10) == 0 {
|
|
println(i);
|
|
}
|
|
if i == 0 {
|
|
println("Primed", i);
|
|
allocator.frozen = true;
|
|
}
|
|
}
|
|
}
|