Skip to content

Commit 016c5d7

Browse files
committed
Avoid memory leak in TypedSplice
1 parent ed386bd commit 016c5d7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/src/dotty/tools/dotc/ast/untpd.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
2929
}
3030

3131
object TypedSplice {
32-
def apply(tree: tpd.Tree)(implicit ctx: Context): TypedSplice =
33-
new TypedSplice(tree)(ctx.owner) {}
32+
def apply(tree: tpd.Tree)(implicit ctx: Context): TypedSplice = {
33+
val curOwner = ctx.owner // compute here to avoid space leak with a reference from TypedSplice to Context
34+
new TypedSplice(tree)(curOwner) {}
35+
}
3436
}
3537

3638
/** mods object name impl */

0 commit comments

Comments
 (0)