Skip to content

Commit ca8def4

Browse files
committed
Plug another space leak.
`initInfo` was retained in Symbols. When called from `Namer`, `initInfo` referred to a completer, which referred to a context. With this space leak plugged, we can now compile 1000 times core/Comments.scala (460lines) with -Xmx400M. There still seems to be a space leak on the order of 200KB per run, though. But that seems to have to do with symbols, not contexts.
1 parent ddec688 commit ca8def4

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ object SymDenotations {
105105
ownerIfExists: Symbol,
106106
final val name: Name,
107107
initFlags: FlagSet,
108-
final val initInfo: Type,
108+
initInfo: Type,
109109
initPrivateWithin: Symbol = NoSymbol) extends SingleDenotation(symbol) {
110110

111111
//assert(symbol.id != 4940, name)
@@ -232,7 +232,7 @@ object SymDenotations {
232232
case _ =>
233233
}
234234
*/
235-
if (Config.checkNoSkolemsInInfo) assertNoSkolems(initInfo)
235+
if (Config.checkNoSkolemsInInfo) assertNoSkolems(tp)
236236
myInfo = tp
237237
}
238238

@@ -751,7 +751,7 @@ object SymDenotations {
751751
// def isOverridable: Boolean = !!! need to enforce that classes cannot be redefined
752752
def isSkolem: Boolean = name == nme.SKOLEM
753753

754-
def isInlineMethod(implicit ctx: Context): Boolean = is(InlineMethod, butNot = Accessor)
754+
def isInlineMethod(implicit ctx: Context): Boolean = is(InlineMethod, butNot = Accessor)
755755

756756
// ------ access to related symbols ---------------------------------
757757

src/dotty/tools/dotc/typer/ProtoTypes.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,11 +477,9 @@ object ProtoTypes {
477477
def apply(tp: Type) = wildApprox(tp, this)
478478
}
479479

480-
@sharable private def dummyTree = untpd.Literal(Constant(null))
481-
482480
/** Dummy tree to be used as an argument of a FunProto or ViewProto type */
483481
object dummyTreeOfType {
484-
def apply(tp: Type): Tree = dummyTree withTypeUnchecked tp
482+
def apply(tp: Type): Tree = untpd.Literal(Constant(null)) withTypeUnchecked tp
485483
def unapply(tree: Tree): Option[Type] = tree match {
486484
case Literal(Constant(null)) => Some(tree.typeOpt)
487485
case _ => None

0 commit comments

Comments
 (0)