Skip to content

High memory usage with optimizations #1322

@marvinborner

Description

@marvinborner

As discussed in #1321. With --optimize, Effekt uses a lot of memory. Several times now this led to a Java heap OOM error for me.

Here's a stack trace of one such exception, that disappears with --no-optimize:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at scala.collection.Iterator$ConcatIterator.concat(Iterator.scala:1198)
	at scala.collection.Iterator.concat(Iterator.scala:625)
	at scala.collection.Iterator.concat$(Iterator.scala:625)
	at scala.collection.AbstractIterator.concat(Iterator.scala:1306)
	at scala.collection.View$Concat.iterator(View.scala:318)
	at scala.collection.mutable.Growable.addAll(Growable.scala:60)
	at scala.collection.mutable.Growable.addAll$(Growable.scala:57)
	at scala.collection.immutable.SetBuilderImpl.addAll(Set.scala:405)
	at scala.collection.immutable.Set$.from(Set.scala:362)
	at scala.collection.immutable.Set$.from(Set.scala:93)
	at scala.collection.IterableFactoryDefaults.fromSpecific(Iterable.scala:945)
	at scala.collection.IterableFactoryDefaults.fromSpecific$(Iterable.scala:945)
	at scala.collection.AbstractIterable.fromSpecific(Iterable.scala:935)
	at scala.collection.AbstractIterable.fromSpecific(Iterable.scala:935)
	at scala.collection.SetOps.concat(Set.scala:235)
	at scala.collection.SetOps.concat$(Set.scala:226)
	at scala.collection.AbstractSet.concat(Set.scala:269)
	at scala.collection.SetOps.$plus$plus(Set.scala:246)
	at scala.collection.SetOps.$plus$plus$(Set.scala:246)
	at scala.collection.AbstractSet.$plus$plus(Set.scala:269)
	at effekt.core.Type$.$anonfun$22(Type.scala:644)
	at effekt.core.Type$$$Lambda/0x00007f216c310e18.apply(Unknown Source)
	at scala.collection.immutable.List.foldRight(List.scala:353)
	at effekt.core.Type$.typecheckFunctionLike(Type.scala:641)
	at effekt.core.Type$.typecheck$$anonfun$8(Type.scala:602)
	at effekt.core.Type$$$Lambda/0x00007f216c310220.apply(Unknown Source)
	at effekt.core.Type$package$.checking(Type.scala:59)
	at effekt.core.Type$.typecheck(Type.scala:499)
	at effekt.core.Stmt.typing$lzyINIT3(Tree.scala:306)
	at effekt.core.Stmt.typing(Tree.scala:306)
	at effekt.core.Type$.typecheck$$anonfun$5(Type.scala:481)
	at effekt.core.Type$$$Lambda/0x00007f216c3132e0.apply(Unknown Source)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions