diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-04-10 23:03:41 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-04-10 23:09:50 +0200 |
commit | f93e2189dd4f6bf129e70f85c03af34e1b507377 (patch) | |
tree | bb54c8b7f6287bcead1e3d02aea0316258a51223 /src/compiler/scala/tools/nsc/typechecker/Namers.scala | |
parent | b448f13d431a1a4e9d23c6acbf4bd15ccb647e3f (diff) | |
download | scala-f93e2189dd4f6bf129e70f85c03af34e1b507377.tar.gz scala-f93e2189dd4f6bf129e70f85c03af34e1b507377.tar.bz2 scala-f93e2189dd4f6bf129e70f85c03af34e1b507377.zip |
Fix memory leak related to default arguments in presentation compiler.
This bug exists for a long time, but was triggered / discovered only lately
by the default argument of mkParams in 118aef558f.
This reverts the workaroud commit 19b6ad5ee4.
The fix is tested by test/files/presentation/memory-leaks which runs the
presentation compiler several times on Typers.scala. I could not reproduce
the memory leak in a smaller test case.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 2539091966..81cf1e3fbe 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -684,7 +684,7 @@ trait Namers extends MethodSynthesis { val acc = sym.lazyAccessor if (acc != NoSymbol) enterIfNotThere(acc) } - defaultParametersOfMethod(sym) foreach enterIfNotThere + defaultParametersOfMethod(sym) foreach { symRef => enterIfNotThere(symRef()) } } this.context } @@ -1161,7 +1161,7 @@ trait Namers extends MethodSynthesis { // if compiling the same local block several times (which can happen in interactive mode) // we might otherwise not find the default symbol, because the second time it the // method symbol will be re-entered in the scope but the default parameter will not. - defaultParametersOfMethod(meth) += default + defaultParametersOfMethod(meth) += new WeakReference(default) } } else if (baseHasDefault) { // the parameter does not have a default itself, but the |