if javac is configured to use larger heap size than external build, use larger value

This commit is contained in:
Eugene Zhuravlev
2012-11-13 23:17:56 +01:00
parent 64792e35ff
commit 3ac45ec9ba
2 changed files with 13 additions and 3 deletions
@@ -18,6 +18,7 @@ package com.intellij.compiler.server;
import com.intellij.ProjectTopics;
import com.intellij.application.options.PathMacrosImpl;
import com.intellij.compiler.CompilerWorkspaceConfiguration;
import com.intellij.compiler.impl.javaCompiler.javac.JavacConfiguration;
import com.intellij.compiler.server.impl.CompileServerClasspathManager;
import com.intellij.execution.ExecutionAdapter;
import com.intellij.execution.ExecutionException;
@@ -733,7 +734,14 @@ public class BuildManager implements ApplicationComponent{
cmdLine.setExePath(vmExecutablePath);
//cmdLine.addParameter("-XX:MaxPermSize=150m");
//cmdLine.addParameter("-XX:ReservedCodeCacheSize=64m");
final int heapSize = config.COMPILER_PROCESS_HEAP_SIZE;
int heapSize = config.COMPILER_PROCESS_HEAP_SIZE;
// todo: remove when old make implementation is removed
if (heapSize == CompilerWorkspaceConfiguration.DEFAULT_COMPILE_PROCESS_HEAP_SIZE) {
// check if javac is set to use larger heap, and if so, use it.
heapSize = Math.max(heapSize, JavacConfiguration.getOptions(project, JavacConfiguration.class).MAXIMUM_HEAP_SIZE);
}
final int xms = heapSize / 2;
if (xms > 32) {
cmdLine.addParameter("-Xms" + xms + "m");