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/debug: add garbage collection controls #4090

Closed
rsc opened this issue Sep 17, 2012 · 8 comments
Closed

runtime/debug: add garbage collection controls #4090

rsc opened this issue Sep 17, 2012 · 8 comments
Assignees
Milestone

Comments

@rsc
Copy link
Contributor

@rsc rsc commented Sep 17, 2012

The history information is already accessible using runtime.ReadMemStats, but that is
more expensive than it needs to be just to get some info about past GCs. (In particular
it does not need to stop the world.) Perhaps we should have a separate ReadGCStats that
can be cheaper. It would be nice to have the tukey summary of the pause list as well as
the duration and start time of the most recent pause. The start time may not be recorded
anywhere right now and need to be added.
@rsc
Copy link
Contributor Author

@rsc rsc commented Dec 10, 2012

Comment 1:

// in runtime/debug
package debug
type GarbageStats struct {
    PauseHistory []int64 // most recent first
    LastGC time.Time
    Tukey5 [5]int64
}
func ReadGarbageStats(*GarbageStats)
Putting this in runtime/debug makes it possible to import time.
Parts of the implementation would be in runtime but define symbols in runtime/debug.
@rsc
Copy link
Contributor Author

@rsc rsc commented Dec 10, 2012

Comment 2:

Issue #4091 has been merged into this issue.

@rsc
Copy link
Contributor Author

@rsc rsc commented Dec 10, 2012

Comment 3:

Also, still in runtime/debug
s/GarbageStats/GCStats/
s/ReadGarbageStats/ReadGCStats/
func EnableGC(enabled bool) bool // returns old setting
func SetGCPercent(percent int) int // returns old setting
@rsc
Copy link
Contributor Author

@rsc rsc commented Dec 10, 2012

Comment 4:

Issue #4171 has been merged into this issue.

@rsc
Copy link
Contributor Author

@rsc rsc commented Dec 10, 2012

Comment 5:

Also, still in runtime/debug
// FreeOSMemory attempts to return unused pages of memory back to the
// operating system. It is best effort and not guaranteed to accomplish anything.
func FreeOSMemory()
@rsc
Copy link
Contributor Author

@rsc rsc commented Dec 10, 2012

Comment 6:

Labels changed: added size-m.

@rsc
Copy link
Contributor Author

@rsc rsc commented Dec 10, 2012

Comment 7:

Labels changed: added suggested.

@rsc
Copy link
Contributor Author

@rsc rsc commented Feb 4, 2013

Comment 8:

This issue was closed by revision 472354f.

Status changed to Fixed.

@rsc rsc self-assigned this Feb 4, 2013
@golang golang locked and limited conversation to collaborators Dec 8, 2014
@golang golang unlocked this conversation Dec 8, 2014
@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants