summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrançois Garillot <francois@garillot.net>2013-09-06 11:14:43 +0200
committerFrançois Garillot <francois@garillot.net>2013-09-19 11:16:01 +0200
commitb0abc2d9e82ffb01fdeb423c8c10c69033d5f2dd (patch)
tree7ce2547bbaec7def709fb5a243949f66ab0252ae /src
parent7f3a7a4e39642f03f3fc32467c14ea718036cf6c (diff)
downloadscala-b0abc2d9e82ffb01fdeb423c8c10c69033d5f2dd.tar.gz
scala-b0abc2d9e82ffb01fdeb423c8c10c69033d5f2dd.tar.bz2
scala-b0abc2d9e82ffb01fdeb423c8c10c69033d5f2dd.zip
Uses a WeakHashMap to constrain memory footprint of docComments
Diffstat (limited to 'src')
-rwxr-xr-xsrc/compiler/scala/tools/nsc/ast/DocComments.scala10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala
index f2e5c9b1eb..7cf2f8559b 100755
--- a/src/compiler/scala/tools/nsc/ast/DocComments.scala
+++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala
@@ -18,8 +18,14 @@ trait DocComments { self: Global =>
val cookedDocComments = mutable.HashMap[Symbol, String]()
- /** The raw doc comment map */
- val docComments = mutable.HashMap[Symbol, DocComment]()
+ /** The raw doc comment map
+ *
+ * In IDE, background compilation runs get interrupted by
+ * reloading new sourcefiles. This is weak to avoid
+ * memleaks due to the doc of their cached symbols
+ * (e.g. in baseTypeSeq) between periodic doc reloads.
+ */
+ val docComments = mutable.WeakHashMap[Symbol, DocComment]()
def clearDocComments() {
cookedDocComments.clear()