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: document that MemStats.Lookups is always zero #55915
Comments
Please include answers to questions from the issue template:
Note that the release policy means there will be minor releases for Go 1.19 and 1.18, not older. |
@dmitshur hello,I want to get the value of runtime.MEMstats.Lookups in the latest version 1.19, but It's always going to be 0. I see that in the 1.11 submission history, someone changed this, and in the end, lookups was discarded, but the reason is not explained clearly.I want to know the reason for the abandonment |
Yes, 1.10 prints 3 (on linux/amd64). But many runtime internal implementation details change from version to version. So this is not a sufficient evidence to prove the field is discarded. |
It does looks the Lookups field is never used as L-values now. |
@ZekeLu I looked at the submission information, but I couldn't see the fundamental reason why the lookups count was dropped, perhaps because the statistic itself doesn't mean much.The field is still there for downward compatibility |
@mknyszek Is this something you're familiar with? The issue here seems to be that the Does the documentation need to be updated, or is its current description fine and this is working as intended? |
I believe this just needs a documentation update to say the field is deprecated. |
What Michael said is correct, the documentation is just out of date. As for why it was set to zero, one reason why might be that this needs to be tracked on a very hot path in the runtime, so it's a cost everyone would pay for. I'll update the docs. |
Change https://go.dev/cl/502155 mentions this issue: |
MemStats.Lookups
for Go 1.11
MemStats.Lookups
for Go 1.11
This field has basically been deprecated since Go 1.11. I don't know the procedure we should follow for deprecating it. I filed #60714 to find out. |
package main
import "fmt"
import "runtime"
func main () {
var a = runtime.MemStats{}
runtime.ReadMemStats(&a)
fmt.Printf("%+v\n", a.Lookups)
}
The text was updated successfully, but these errors were encountered: