diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java index 4a6ededba9b6103720b5e7d49202ec778b612c6e..dd68c15f3a66753ccf27bed53273331db337bcf7 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java @@ -192,7 +192,11 @@ public class FastRContext { if (pc == 1) { ContextInfo info = createContextInfo(contextKind); PolyglotEngine vm = info.createVM(); - results[0] = RContext.EvalThread.run(vm, info, RSource.fromTextInternal(exprs.getDataAt(0), RSource.Internal.CONTEXT_EVAL)); + try { + results[0] = RContext.EvalThread.run(vm, info, RSource.fromTextInternal(exprs.getDataAt(0), RSource.Internal.CONTEXT_EVAL)); + } finally { + vm.dispose(); + } } else { // separate threads that run in parallel; invoking thread waits for completion RContext.EvalThread[] threads = new RContext.EvalThread[pc];