OutOfMemoryError on my BF interpreter
Josef Eisl
josef.eisl at jku.at
Wed May 2 07:37:30 UTC 2018
Hi Cristian!
Thanks for your report. We have very recently merged a change to
mitigate the OOME in this part of linear scan [1]. Unfortunately this
was after the release so it is not included in 1.0.0 RC1. You would need
to build your own GraalVM from source to see if the change helps.
That said, the root cause of the OOME is usually a huge compilation unit
thrown into the compiler. For more details, see also the discussion on
the OpenJDK bug tracker [2].
The reasons for big compilation units can me manifold. In case of
Truffle, the issues can often be solved by adding TruffleBoundaries [3],
i.e., instructing the compiler not to inline specified methods into the
truffle graph. Maybe a Truffle expert can give you more hints on that.
Hope that helps,
Josef
[1]:
https://github.com/oracle/graal/commit/c0a15c562daa0338f61a6e7c22476cf145af5a66
[2]: https://bugs.openjdk.java.net/browse/JDK-8199890
[3]:
http://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/CompilerDirectives.TruffleBoundary.html
On 01/05/18 08:24, Cristian Esquivias wrote:
> With the release of 1.0.0-RC1 I thought I'd come back and see how
> Graal is doing. Great job; Graal is really starting to look like the
> platform everyone should pay attention to.
>
> To get back into it, I built a Brainf*ck interpreter with Truffle
> (https://github.com/cesquivias/bf-graal). I modeled it after
> simplelanguage so it should be easy to build and run.
>
> While running the mandelbrot program, about halfway through the
> program, the VM starts throwing OutOfMemoryError exceptions (one
> pasted below). It created a zip file under dumps/ but it contains a
> .bgv file I don't what to do with and a log file that just contains
> the stacktrace.
>
> I ran jvisualvm and took a heap dump. There are ~200k long[] objects
> alone created by graal taking up ~50% of the memory. Digging through
> the references it seems to be created/retained in
>
> org.graalvm.compiler.lir.alloc.lsra.LinearScanLifetimeAnalysisPhase$$Lambda$48#1
> [GC root - Java frame]
>
> I'd provide some file from jvisualvm but the save button is grayed
> out. I hope this is enough info. My interpreter is up on GitHub so
> feel free to test it out.
>
> I tested this both on the community & enterprise edition on Ubuntu
> 18.04 in VirtualBox.
>
> - Cristian
>
>
> Thread[TruffleCompilerThread-12,10,main]: Compilation of
> BFRepeatingNode at 222b298d<OSR> failed: java.lang.OutOfMemoryError: Java
> heap space
> at org.graalvm.compiler.lir.util.IndexedValueMap.<init>(IndexedValueMap.java:55)
> at org.graalvm.compiler.lir.dfa.RegStackValueSet.<init>(RegStackValueSet.java:62)
> at org.graalvm.compiler.lir.dfa.RegStackValueSet.copy(RegStackValueSet.java:70)
> at org.graalvm.compiler.lir.dfa.RegStackValueSet.copy(RegStackValueSet.java:46)
> at org.graalvm.compiler.lir.dfa.LocationMarker.processBlock(LocationMarker.java:107)
> at org.graalvm.compiler.lir.dfa.LocationMarker.build(LocationMarker.java:81)
> at org.graalvm.compiler.lir.dfa.LocationMarkerPhase.run(LocationMarkerPhase.java:51)
> at org.graalvm.compiler.lir.dfa.LocationMarkerPhase.run(LocationMarkerPhase.java:47)
> at org.graalvm.compiler.lir.phases.LIRPhase.apply(LIRPhase.java:115)
> at org.graalvm.compiler.lir.phases.LIRPhase.apply(LIRPhase.java:107)
> at org.graalvm.compiler.lir.phases.LIRPhaseSuite.run(LIRPhaseSuite.java:96)
> at org.graalvm.compiler.lir.phases.LIRPhase.apply(LIRPhase.java:115)
> at org.graalvm.compiler.lir.phases.LIRPhase.apply(LIRPhase.java:107)
> at org.graalvm.compiler.core.GraalCompiler.emitLowLevel(GraalCompiler.java:367)
> at org.graalvm.compiler.core.GraalCompiler.emitLIR0(GraalCompiler.java:336)
> at org.graalvm.compiler.core.GraalCompiler.emitLIR(GraalCompiler.java:295)
> at org.graalvm.compiler.core.GraalCompiler.emitBackEnd(GraalCompiler.java:275)
> at org.graalvm.compiler.core.GraalCompiler.compile(GraalCompiler.java:175)
> at org.graalvm.compiler.core.GraalCompiler.compileGraph(GraalCompiler.java:160)
> at org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl.compilePEGraph(TruffleCompilerImpl.java:445)
> at org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl.compileAST(TruffleCompilerImpl.java:391)
> at org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl$TruffleCompilationWrapper.performCompilation(TruffleCompilerImpl.java:544)
> at org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl$TruffleCompilationWrapper.performCompilation(TruffleCompilerImpl.java:493)
> at org.graalvm.compiler.core.CompilationWrapper.run(CompilationWrapper.java:167)
> at org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl.doCompile(TruffleCompilerImpl.java:222)
> at org.graalvm.compiler.truffle.runtime.GraalTruffleRuntime.doCompile(GraalTruffleRuntime.java:679)
> at org.graalvm.compiler.truffle.runtime.GraalTruffleRuntime$1.run(GraalTruffleRuntime.java:745)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> To disable compilation failure notifications, set
> CompilationFailureAction to Silent (e.g.,
> -Dgraal.CompilationFailureAction=Silent).
> To print a message for a compilation failure without retrying the
> compilation, set CompilationFailureAction to Print (e.g.,
> -Dgraal.CompilationFailureAction=Print).
> Retrying compilation of BFRepeatingNode at 222b298d<OSR>
>
More information about the graal-dev
mailing list