What version of Go are you using (go version)?
$ go version
go version go1.14.1 windows/amd64
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\35084\AppData\Local\go-build
set GOENV=C:\Users\35084\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=*.lingcb.net
set GONOSUMDB=*.lingcb.net
set GOOS=windows
set GOPATH=D:\go
set GOPRIVATE=*.lingcb.net
set GOPROXY=https://goproxy.cn,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\35084\AppData\Local\Temp\go-build075262326=/tmp/go-build -gno-record-gcc-switches
GOROOT/bin/go version: go version go1.14.1 windows/amd64
GOROOT/bin/go tool compile -V: compile version go1.14.1
gdb --version: GNU gdb (GDB) 8.2.1
What did you do?
Used memory cannot be freed.

package main
import (
"fmt"
"runtime"
"runtime/debug"
"time"
)
func main() {
var a []int
for i := 0; i < 2000; i++ {
a = make([]int, i*100000)
}
a = nil
fmt.Printf("%v\n", a)
go func() {
for {
m := runtime.MemStats{}
d := debug.GCStats{}
runtime.ReadMemStats(&m)
debug.ReadGCStats(&d)
fmt.Printf("%v\t%v\t%v\n", d.NumGC, m.HeapIdle/1024/1024, m.HeapInuse/1024/1024)
time.Sleep(time.Second)
}
}()
for {
runtime.GC()
time.Sleep(time.Second)
}
}
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Used memory cannot be freed.