diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-24 15:37:14 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-24 18:56:48 +0100 |
commit | ed7755b781bd1b444d38329cb22eacaa3fc1c005 (patch) | |
tree | 2eb43f71741310e77248111f5fa5c39203e33c8d /src/dotty/tools/dotc/typer/Implicits.scala | |
parent | cdeafeafd252b20a0df5440e0420211af95e0cdc (diff) | |
download | dotty-ed7755b781bd1b444d38329cb22eacaa3fc1c005.tar.gz dotty-ed7755b781bd1b444d38329cb22eacaa3fc1c005.tar.bz2 dotty-ed7755b781bd1b444d38329cb22eacaa3fc1c005.zip |
Avoid memory leaks on repeated compilation.
Several measures:
1. Invalidate classOfId and superIdOfClass in ContextBase after each run. These contain local classes
that should become inaccessible.
2. Also clear implicitScope cache that maps types to their implicit scopes after each run. (not sure whether
this is needed; it did show up in paths from root, but on second thought this might have been a gc-able
cycle.
3. Avoid capturing contexts in lazy annotations.
4. Avoid capturing contexts in functions that compute souceModule and moduleClass
5. Avoid capturing contexts in Unpickler's postReadOp hook.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Implicits.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Implicits.scala | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala index 7d03b1edf..008fe8966 100644 --- a/src/dotty/tools/dotc/typer/Implicits.scala +++ b/src/dotty/tools/dotc/typer/Implicits.scala @@ -347,6 +347,8 @@ trait ImplicitRunInfo { self: RunInfo => val useCount = new mutable.HashMap[TermRef, Int] { override def default(key: TermRef) = 0 } + + def clear() = implicitScopeCache.clear() } /** The implicit resolution part of type checking */ |