Skip to content

Fix some memory leaks #2876

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 7 commits into from
Jul 18, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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/Symbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,9 @@ trait Symbols { this: Context =>
info = completer,
privateWithin = ttmap1.mapOwner(odenot.privateWithin), // since this refers to outer symbols, need not include copies (from->to) in ownermap here.
annotations = odenot.annotations)

}

copies.foreach(_.ensureCompleted()) // avoid memory leak
copies
}

Expand Down
8 changes: 7 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3175,7 +3175,13 @@ object Types {
final class TypeVar(val origin: TypeParamRef, creatorState: TyperState, val bindingTree: untpd.Tree, val owner: Symbol) extends CachedProxyType with ValueType {

/** The permanent instance type of the variable, or NoType is none is given yet */
private[core] var inst: Type = NoType
private[this] var myInst: Type = NoType

private[core] def inst = myInst
private[core] def inst_=(tp: Type) = {
myInst = tp
if (tp.exists) owningState = null // no longer needed; null out to avoid a memory leak
}

/** The state owning the variable. This is at first `creatorState`, but it can
* be changed to an enclosing state on a commit.
Expand Down