From 0ebf8c2f6e0491522d2eac5a158ee20134f44361 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Mon, 20 Aug 2018 18:56:16 +0300 Subject: [PATCH] Reduce memory consumption --- .../java/org/teavm/dependency/DependencyAnalyzer.java | 9 +++++++++ core/src/main/java/org/teavm/vm/TeaVM.java | 1 + 2 files changed, 10 insertions(+) diff --git a/core/src/main/java/org/teavm/dependency/DependencyAnalyzer.java b/core/src/main/java/org/teavm/dependency/DependencyAnalyzer.java index 16eac0392..b8648786e 100644 --- a/core/src/main/java/org/teavm/dependency/DependencyAnalyzer.java +++ b/core/src/main/java/org/teavm/dependency/DependencyAnalyzer.java @@ -675,6 +675,15 @@ public class DependencyAnalyzer implements DependencyInfo { } } + public void cleanup() { + for (MethodReference reachableMethod : getReachableMethods()) { + MethodDependency dependency = getMethod(reachableMethod); + for (int i = dependency.getParameterCount() + 1; i < dependency.getVariableCount(); ++i) { + dependency.variableNodes[i] = null; + } + } + } + static class ReportEntry { String title; int count; diff --git a/core/src/main/java/org/teavm/vm/TeaVM.java b/core/src/main/java/org/teavm/vm/TeaVM.java index c8a9dbb03..ca06d2c7f 100644 --- a/core/src/main/java/org/teavm/vm/TeaVM.java +++ b/core/src/main/java/org/teavm/vm/TeaVM.java @@ -386,6 +386,7 @@ public class TeaVM implements TeaVMHost, ServiceRepository { return; } + dependencyAnalyzer.cleanup(); inline(classSet, dependencyAnalyzer); if (wasCancelled()) { return;