Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GODEBUG=gctrace=1 ./myapp, the output heap goal incorrect? #68643

Closed
hitzhangjie opened this issue Jul 30, 2024 · 2 comments
Closed

GODEBUG=gctrace=1 ./myapp, the output heap goal incorrect? #68643

hitzhangjie opened this issue Jul 30, 2024 · 2 comments

Comments

@hitzhangjie
Copy link
Contributor

hitzhangjie commented Jul 30, 2024

Go version

go 1.22.3

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/<username>/go/pkg/mod'
GONOPROXY='none'
GOOS='linux'
GOPATH='/home/<username>/go'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3021393819=/tmp/go-build -gno-record-gcc-switches'

What did you do?

  1. write a programme to allocate 1MB memory each second
  2. don't release the memory
  3. watch the GC output, the GC start, the GC end, the heapAlive, the heapGoal size

What did you see happen?

GOGC=100 GODEBUG=gctrace=1 ./test_examples
allocate: 1 MB
allocate: 2 MB
allocate: 3 MB
allocate: 4 MB
gc 1 @3.003s 0%: 0.012+0.15+0.003 ms clock, 0.29+0/0.16/0+0.074 ms cpu, 4->4->4 MB, 4 MB goal, 0 MB stacks, 0 MB globals, 24 P
allocate: 5 MB
allocate: 6 MB
allocate: 7 MB
allocate: 8 MB
allocate: 9 MB
gc 2 @8.004s 0%: 0.16+0.72+0.011 ms clock, 3.9+0/0.73/0+0.28 ms cpu, 9->9->9 MB, 9 MB goal, 0 MB stacks, 0 MB globals, 24 P
allocate: 10 MB
allocate: 11 MB
allocate: 12 MB
allocate: 13 MB
allocate: 14 MB
allocate: 15 MB
allocate: 16 MB
allocate: 17 MB
allocate: 18 MB
allocate: 19 MB
gc 3 @18.008s 0%: 0.087+0.23+0.006 ms clock, 2.0+0/0.23/0+0.14 ms cpu, 19->19->19 MB, 19 MB goal, 0 MB stacks, 0 MB globals, 24 P
allocate: 20 MB
allocate: 21 MB
allocate: 22 MB
allocate: 23 MB
allocate: 24 MB
allocate: 25 MB
allocate: 26 MB
allocate: 27 MB
allocate: 28 MB
allocate: 29 MB
allocate: 30 MB
allocate: 31 MB
allocate: 32 MB
allocate: 33 MB
allocate: 34 MB
allocate: 35 MB
allocate: 36 MB
allocate: 37 MB
allocate: 38 MB

What did you expect to see?

want to see the correct size of heapGoal, it looks like incorrect.

@seankhliao
Copy link
Member

seankhliao commented Jul 30, 2024

There's no info here for us to take action on.

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants