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: runtime.GC() does not trigger GC if GOGC=off #22023

Closed
aclements opened this issue Sep 25, 2017 · 6 comments
Closed

runtime: runtime.GC() does not trigger GC if GOGC=off #22023

aclements opened this issue Sep 25, 2017 · 6 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge release-blocker
Milestone

Comments

@aclements
Copy link
Member

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

go version go1.9 linux/amd64

Also happens on master.

What did you do?

Attempt to manually trigger a GC using runtime.GC() while GOGC is set to off:
https://play.golang.org/p/vB6-urJJ7M

What did you expect to see?

The GC should run.

What did you see instead?

The GC does not run.

This is a regression from 1.8 caused by my rewrite of gcShouldStart into (gcTrigger).test. I've marked this for Go 1.9.1. I'm not sure how important it is, but it's also easy to fix.

/cc @RLH

@aclements aclements added this to the Go1.9.1 milestone Sep 25, 2017
@aclements aclements self-assigned this Sep 25, 2017
@gopherbot
Copy link

Change https://golang.org/cl/65994 mentions this issue: runtime: make runtime.GC() trigger GC even if GOGC=off

@RLH
Copy link
Contributor

RLH commented Sep 25, 2017 via email

@aclements
Copy link
Member Author

Re-opening for cherry-pick to 1.9

@aclements aclements reopened this Sep 26, 2017
@rsc rsc modified the milestones: Go1.9.1, Go1.9.2 Oct 4, 2017
@rsc
Copy link
Contributor

rsc commented Oct 13, 2017

CL 65994 OK for Go 1.9.2.

@rsc rsc added the CherryPickApproved Used during the release process for point releases label Oct 14, 2017
@gopherbot
Copy link

Change https://golang.org/cl/70979 mentions this issue: [release-branch.go1.9] runtime: make runtime.GC() trigger GC even if GOGC=off

gopherbot pushed a commit that referenced this issue Oct 25, 2017
…GOGC=off

Currently, the priority of checks in (gcTrigger).test() puts the
gcpercent<0 test above gcTriggerCycle, which is used for runtime.GC().
This is an unintentional change from 1.8 and before, where
runtime.GC() triggered a GC even if GOGC=off.

Fix this by rearranging the priority so the gcTriggerCycle test
executes even if gcpercent < 0.

Fixes #22023.

Change-Id: I109328d7b643b6824eb9d79061a9e775f0149575
Reviewed-on: https://go-review.googlesource.com/65994
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-on: https://go-review.googlesource.com/70979
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
@rsc
Copy link
Contributor

rsc commented Oct 26, 2017

go1.9.2 has been packaged and includes:

The release is posted at golang.org/dl.

— golang.org/x/build/cmd/releasebot, Oct 26 21:09:17 UTC

@rsc rsc closed this as completed Oct 26, 2017
@golang golang locked and limited conversation to collaborators Oct 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge release-blocker
Projects
None yet
Development

No branches or pull requests

5 participants