-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Description
What version of Go are you using (go version)?
$ go version go version go1.16.5 windows/amd64
Does this issue reproduce with the latest release?
As I tested with 1.14.15 and 1.15.13, in 1.15 there was the exact same issue but in 1.14 it was less visible
What operating system and processor architecture are you using (go env)?
Windows 10 Pro 64bit (version 21H1)
Also code checked on Ubuntu 20.04 btw
go env Output
$ go env set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\mrali\AppData\Local\go-build set GOENV=C:\Users\mrali\AppData\Roaming\go\env set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE=C:\Users\mrali\go\pkg\mod set GONOPROXY= set GONOSUMDB= set GOOS=windows set GOPATH=C:\Users\mrali\go set GOPRIVATE= set GOPROXY=https://proxy.golang.org,direct set GOROOT=C:\Program Files\Go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64 set GOVCS= set GOVERSION=go1.16.5 set GCCGO=gccgo set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD=C:\Users\mrali\Desktop\Projects\LlamaNiteReWrite\go.mod 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\mrali\AppData\Local\Temp\go-build3682471824=/tmp/go-build -gno-record-gcc-switches
What did you do?
A small part of the code (also the main issue) was something like this:
https://play.golang.org/p/0mkjppbKZVp
What did you expect to see?
I expected 0 ram usage because it was useless at that moment and function was closed,
Also, yes I can accept the first ~60 MiB Ram usage, but the second time I don't think could be normal
What did you see instead?
The first time used ~60 MiB ram even function was closed and I didn't use that image,
The second time it used ~60 MiB more ram, And Third, Fourth, ... time had the same usage as the second time.
What you want now?
I am a newbie Go developer, so I don't know a lot of things...
If there is a way to fix my code, please suggest to I use it, I have more than 1GB Ram usage only because of this.
In my opinion, it would be cool if something like .Close() to force removing the whole image from memory be added in the next updates, or... I don't know...
Thanks for reading and helps.