arrow-kt / arrow-kt/arrow-analysis
[BUG] OutOfMemoryError at arrow.meta.plugins.analysis.phases.analysis.solver.state.SolverState.addConstraint(SolverState.kt:83)
- Dominant language
- Kotlin
- Stars
- 30
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
I receive OutOfMemoryError after a few minutes of compilation. Project is not big < 1000 lines. This issue occurs to me with Kotlin 1.7.20 and 1.6.21. I tried it also with a few times bigger project and it compiled successfully.
```
java.lang.OutOfMemoryError: Java heap space
at java.base/java.util.HashMap.resize(HashMap.java:700)
at java.base/java.util.HashMap.putVal(HashMap.java:659)
at java.base/java.util.HashMap.put(HashMap.java:608)
at de.uni_freiburg.informatik.ultimate.util.datastructures.ScopedHashMap.put(ScopedHashMap.java:305)
at de.uni_freiburg.informatik.ultimate.logic.Theory.defineFunction(Theory.java:1470)
at de.uni_freiburg.informatik.ultimate.logic.Theory.defineFunction(Theory.java:1511)
at de.uni_freiburg.informatik.ultimate.logic.NoopScript.defineFunInternal(NoopScript.java:283)
at de.uni_freiburg.informatik.ultimate.logic.NoopScript.annotate(NoopScript.java:507)
at org.sosy_lab.java_smt.solvers.smtinterpol.SmtInterpolTheoremProver.addConstraint(SmtInterpolTheoremProver.java:43)
at org.sosy_lab.java_smt.solvers.smtinterpol.SmtInterpolTheoremProver.addConstraint(SmtInterpolTheoremProver.java:25)
at org.sosy_lab.java_smt.basicimpl.withAssumptionsWrapper.BasicProverWithAssumptionsWrapper.addConstraint(BasicProverWithAssumptionsWrapper.java:48)
at arrow.meta.plugins.analysis.phases.analysis.solver.state.SolverState.addConstraint(SolverState.kt:83)
at arrow.meta.plugins.analysis.phases.analysis.solver.state.SolverState.newName(SolverState.kt:106)
at arrow.meta.plugins.analysis.phases.analysis.solver.check.ExpressionsKt.checkRegularFunctionCall(Expressions.kt:562)
at arrow.meta.plugins.analysis.phases.analysis.solver.check.ExpressionsKt.checkCallExpression(Expressions.kt:425)
at arrow.meta.plugins.analysis.phases.analysis.solver.check.ExpressionsKt.fallThrough(Expressions.kt:259)
at arrow.meta.plugins.analysis.phases.analysis.solver.check.ExpressionsKt.access$fallThrough(Expressions.kt:1)
at arrow.meta.plugins.analysis.phases.analysis.solver.check.ExpressionsKt$checkExpressionConstraints$2.invoke(Expressions.kt:243)
at arrow.meta.plugins.analysis.phases.analysis.solver.check.ExpressionsKt$checkExpressionConstraints$2.invoke(Expressions.kt:156)
at arrow.meta.continuations.ContSeq$flatMap$1.invokeSuspend(ContSeq.kt:60)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at arrow.meta.continuations.ContSeqBuilder.hasNext(ContSeq.kt:233)
at arrow.meta.continuations.ContSeq$map$1.invokeSuspend(ContSeq.kt:292)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at arrow.meta.continuations.ContSeqBuilder.hasNext(ContSeq.kt:233)
at arrow.meta.continuations.ContSeq$flatMap$1.invokeSuspend(ContSeq.kt:292)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at arrow.meta.continuations.ContSeqBuilder.hasNext(ContSeq.kt:233)
at arrow.meta.continuations.ContSeqBuilder.yieldAll(ContSeq.kt:274)
at arrow.meta.continuations.ContSeqSyntax$DefaultImpls.yieldAll(ContSeq.kt:165)
at arrow.meta.continuations.ContSeqBuilder.yieldAll(ContSeq.kt:203)
at arrow.meta.continuations.ContSeq$flatMap$1.invokeSuspend(ContSeq.kt:60)
```
**Environment (please complete the following information):**
- Kotlin version: 1.7.20 / 1.6.21
- Kotlin Intellij IDEA plugin version: 221-1.7.20-release-201-IJ5591.52
- Intellij IDEA version: 2022.1.4, #IU-221.6008.13, built on July 19, 2022
- Λrrow Analysis: 2.0.2
- arrow-core,arrow-fx-coroutines: 1.1.2
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at arrow.meta.plugins.analysis.phases.analysis.solver.state.SolverState.kt lines 83 and 106, then trace the calls from Expressions.kt lines 562, 425, and 259 into SmtInterpolTheoremProver.addConstraint. Reproduce the reported compilation with Kotlin 1.7.20 or 1.6.21 and inspect heap growth around constraint and function creation. Done means the reported small project compiles without OutOfMemoryError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100