Skip to content

Fix memory leak through NoDenotation.cachePrefix #11600

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

Merged
merged 2 commits into from
Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Denotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ object Denotations {
type AsSeenFromResult <: PreDenotation

/** The denotation with info(s) as seen from prefix type */
final def asSeenFrom(pre: Type)(using Context): AsSeenFromResult =
def asSeenFrom(pre: Type)(using Context): AsSeenFromResult =
if (Config.cacheAsSeenFrom) {
if ((cachedPrefix ne pre) || ctx.period != validAsSeenFrom) {
cachedAsSeenFrom = computeAsSeenFrom(pre)
Expand Down
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2209,8 +2209,8 @@ object SymDenotations {
ensureCompleted()
myCompanion

override def registeredCompanion_=(c: Symbol) =
myCompanion = c
override def registeredCompanion_=(c: Symbol) =
myCompanion = c

private var myNestingLevel = -1

Expand Down Expand Up @@ -2397,6 +2397,7 @@ object SymDenotations {
override def owner: Symbol = throw new AssertionError("NoDenotation.owner")
override def computeAsSeenFrom(pre: Type)(using Context): SingleDenotation = this
override def mapInfo(f: Type => Type)(using Context): SingleDenotation = this
override def asSeenFrom(pre: Type)(using Context): AsSeenFromResult = this

override def matches(other: SingleDenotation)(using Context): Boolean = false
override def targetName(using Context): Name = EmptyTermName
Expand Down