From b0abc2d9e82ffb01fdeb423c8c10c69033d5f2dd Mon Sep 17 00:00:00 2001 From: François Garillot Date: Fri, 6 Sep 2013 11:14:43 +0200 Subject: Uses a WeakHashMap to constrain memory footprint of docComments --- src/compiler/scala/tools/nsc/ast/DocComments.scala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') 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() -- cgit v1.2.3