-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/compile: cyclic interfaces cause massive memory usage #35146
Comments
/cc: @griesemer @mdempsky |
Interesting. If I had to guess, we're probably failing to take advantage of memoizing some of the sub-expression typechecking. In general though, anonymous and cyclic interfaces are a recurring source of issues. Is this derived from any real world code? |
Believe it or not. It's from (rudimentary) SQL generator. The anonymous interfaces are used to "mask" off methods. It's not terribly important code, but it also wasn't difficult to stumble upon, either. A smaller repro: https://play.golang.org/p/PoFq8QTuiMp type A interface {
A() interface {
A
B() interface{ A }
}
} |
Even smaller: https://play.golang.org/p/Yoll2YkmZNS type A interface {
A() interface{ A }
B() interface{ A }
} |
Thanks for minimizing the test case. To clarify, are you saying it uses a lot of memory but then terminates? Or it's going into an infinite loop allocating more and more memory? (On my phone, and the play links just give a generic compilation failure error.) |
This looks like #1909. |
@mdempsky I cut it off at > 6 GB since my machine only has 8GB. No idea whether it terminates. |
@ALTree Thanks, confirmed it is a dup of that. We just go into an infinite recursion in typefmt. @elagergren-spideroak Thanks for clarifying. |
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/3-RUQ50ubib
What did you expect to see?
Something other than
compile
ballooning to over 6 GB of RAM.Maybe relates to #27256 and #26863.
The text was updated successfully, but these errors were encountered: