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: heap size increases from go1.8b2 to go1.9 (for map objects?) #21641

wolf0403 opened this issue Aug 26, 2017 · 5 comments

runtime: heap size increases from go1.8b2 to go1.9 (for map objects?) #21641

wolf0403 opened this issue Aug 26, 2017 · 5 comments


Copy link

@wolf0403 wolf0403 commented Aug 26, 2017

Please answer these questions before submitting your issue. Thanks!

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

go version go1.8beta2 darwin/amd64
go version go1.9 darwin/amd64

Does this issue reproduce with the latest release?

go1.9 is the latest release.

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

$ go env
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/gg/sjs9r81j4pn_jfr5dsb2vdmm0000gn/T/go-build863027025=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on is best.

Code and Makefile:

What did you expect to see?

go1.9 performs on-par or better than previous versions.

What did you see instead?

$ make run
time ./m-1.8
690.032 690.032
2.95 real 3.67 user 0.84 sys
time ./m-1.9
693.451 693.451
2.81 real 3.53 user 0.63 sys

If I replace string values using string pointer -

$ make run
/usr/local/Cellar/go/1.8beta2_1/bin/go build -o m-1.8 m.go
/usr/local/Cellar/go/1.9/bin/go build -o m-1.9 m.go
time ./m-1.8
477.742 477.742
2.69 real 3.79 user 0.74 sys
time ./m-1.9
480.171 480.171
2.74 real 3.52 user 0.42 sys

There is always (?) a ~3M increase in heap usage.


This comment has been minimized.

Copy link

@odeke-em odeke-em commented Aug 27, 2017


This comment has been minimized.

Copy link

@OneOfOne OneOfOne commented Aug 27, 2017

Am I reading the numbers wrong? because it is slightly faster while only using 3 extra MBs.


This comment has been minimized.

Copy link

@aclements aclements commented Aug 28, 2017

I'm not sure what the issue here is. Your first example runs faster by all metrics in Go 1.9 and your second example consumes less user and system time with Go 1.9, which suggests that the slightly higher real time is from system noise or frequency scaling. I'm not particularly concerned about a 0.5% increase in RSS (especially without statistically significant evidence that there actually is a change; though even then I wouldn't be particularly concerned).

Perhaps you could clarify what the concern is?


This comment has been minimized.

Copy link

@wolf0403 wolf0403 commented Aug 28, 2017

The time spent by each program varies a lot (it's reported by "time ./binary" from bash - I just did some re-run and get 2.76vs2.88, 2.82vs2.71) so I don't think it is saying Go 1.9 is consistently slower or faster in a conclusive way.

But in all my runs there is an increase in heap size in 1.9. The difference is small but consistent.

I'm fine if you say this is expected / known / too small to have real negative impact, etc.

const size = 10000000 / 10
58.415 58.415
60.071 60.071

const size = 10000000 / 100
4.031 4.031
4.056 4.056


This comment has been minimized.

Copy link

@aclements aclements commented Aug 29, 2017

Thanks for the update. I'm not concerned about small heap changes like this, though. Small fluctuations between releases are quite common for a huge number of reasons.

@aclements aclements closed this Aug 29, 2017
@golang golang locked and limited conversation to collaborators Aug 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.