-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: GC pause on Go 1.5 is much longer than Go 1.4 when there is a map with lots of entries. #10986
Comments
runtime.GC() does not do a concurrent GC, it does a STW GC which accounts Below is the same program that prints out some diagnostics, there are 14 .rlh@rlh0:~/work/code/bugs/latency1/src$ ./latency gc #1 @0.038s 9%: 0+0+0+3+0 ms clock, 0+0+0+0/3/0+0 ms cpu, 4->7->3 On Fri, May 29, 2015 at 10:30 AM, Ian Lance Taylor <[email protected]
|
Just a minor addition: stats.Pause doesn't accurately reflect the pause times of concurrent GCs right now, though it will be accurate for the forced STW GC that this test program is doing. Currently the only way to get accurate pause times for concurrent GCs is setting GODEBUG=gctrace=1 (which is what @RLH did). The issue with GCStats.Pause is #10323. Perhaps runtime.GC needs documentation explaining that it does a STW GC? |
CL https://golang.org/cl/10488 mentions this issue. |
runtime.GC() is intentionally very weakly specified. However, it is so weakly specified that it's difficult to know that it's being used correctly for its one intended use case: to ensure garbage collection has run in a test that is garbage-sensitive. In particular, it is unclear whether it is synchronous or asynchronous. In the old STW collector this was essentially self-evident; short of queuing up a garbage collection to run later, it had to be synchronous. However, with the concurrent collector, there's evidence that people are inferring that it may be asynchronous (e.g., issue #10986), as this is both unclear in the documentation and possible in the implementation. In fact, runtime.GC() runs a fully synchronous STW collection. We probably don't want to commit to this exact behavior. But we can commit to the essential property that tests rely on: that runtime.GC() does not return until the GC has finished. Change-Id: Ifc3045a505e1898ecdbe32c1f7e80e2e9ffacb5b Reviewed-on: https://go-review.googlesource.com/10488 Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Rick Hudson <[email protected]>
Go version is 1.4.2 and
Go devel +80864cf Fri May 29 04:33:15 2015 +0000
.OS is linux/amd64.
GC pause time is about 600ms on Go 1.5 and 300ms on Go 1.4.
Sample code to test GC pause time.
The text was updated successfully, but these errors were encountered: