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

runtime: GODEBUG=memprofilerate=1 does not take effect. #55100

Closed
578559967 opened this issue Sep 16, 2022 · 4 comments
Closed

runtime: GODEBUG=memprofilerate=1 does not take effect. #55100

578559967 opened this issue Sep 16, 2022 · 4 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@578559967
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.19.1 darwin/arm64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/r/Library/Caches/go-build"
GOENV="/Users/r/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/r/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/robert/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/Users/r/workspace/testgo/go1.19.1/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/r/workspace/testgo/go1.19.1/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19.1"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/j_/rq9ph2cd3h50w468sgv34lwh0000gn/T/go-build2412819877=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

// main.go
package main

import (
	"fmt"
	"runtime"
)

func main() {
	fmt.Println(runtime.MemProfileRate, runtime.MemProfile)
}

go build main.go
GODEBUG=memprofilerate=1 ./main

What did you expect to see?

Expect output,ignore the second value which may be change every time:
1 0x10029a650

What did you see instead?

524288 0x10029a650

more

I also test this on linux-amd64 and it does not work either.
I also test this with different go version. go1.17 and go1.18 and go1.19 all failed. go1.16 works as expect.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Sep 16, 2022
@WangLeonard
Copy link
Contributor

I think it was introduced by https://go-review.googlesource.com/c/go/+/299671

@578559967
Copy link
Author

I think it was introduced by https://go-review.googlesource.com/c/go/+/299671

Yes, you are right. After I revert this commit, it works!

@gopherbot
Copy link

Change https://go.dev/cl/431315 mentions this issue: runtime: init MemProfileRate before parse GODEBUG

@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 19, 2022
@cherrymui cherrymui added this to the Backlog milestone Sep 19, 2022
@WangLeonard
Copy link
Contributor

Hi @cherrymui , does this need backport to 1.18 and 1.19 ?

@golang golang locked and limited conversation to collaborators Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants