]> Cypherpunks repositories - gostls13.git/commit
go/types: ensure that Named.check is nilled out once it is expanded
authorRob Findley <rfindley@google.com>
Fri, 7 May 2021 02:28:37 +0000 (22:28 -0400)
committerRobert Findley <rfindley@google.com>
Wed, 26 May 2021 18:24:48 +0000 (18:24 +0000)
commit39da9ae5130afa58f8b9e4ea609a57d516bd78db
tree949e4f9578693c615669d37afa0056769a58d19f
parentbfd7798a6c756b22d7376db527339b41bf7f7327
go/types: ensure that Named.check is nilled out once it is expanded

To support lazy expansion of defined types, *Named holds on to a
*Checker field, which can pin the *Checker in memory. This can have
meaningful memory implications for applications that keep type
information around.

Ensure that the Checker field is nilled out for any Named types that are
instantiated during the type checking pass, by deferring a clean up to
'later' boundaries.

In testing this almost exactly offset the ~6% memory footprint increase
I observed with 1.17.

Fixes #45580

Change-Id: I8aa5bb777573a924afe36e79fa65f8729336bceb
Reviewed-on: https://go-review.googlesource.com/c/go/+/318849
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/decl.go
src/go/types/sanitize.go
src/go/types/type.go