aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Contexts.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-02-24 15:37:14 +0100
committerMartin Odersky <odersky@gmail.com>2014-02-24 18:56:48 +0100
commited7755b781bd1b444d38329cb22eacaa3fc1c005 (patch)
tree2eb43f71741310e77248111f5fa5c39203e33c8d /src/dotty/tools/dotc/core/Contexts.scala
parentcdeafeafd252b20a0df5440e0420211af95e0cdc (diff)
downloaddotty-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/core/Contexts.scala')
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index cfaa3720f..325ff5f74 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -471,6 +471,9 @@ object Contexts {
def reset() = {
for ((_, set) <- uniqueSets) set.clear()
+ for (i <- 0 until classOfId.length) classOfId(i) = null
+ superIdOfClass.clear()
+ lastSuperId = -1
}
}