diff --git a/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java b/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java index b823bc08232b..3b39a3db6f5e 100644 --- a/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java +++ b/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java @@ -16,6 +16,7 @@ package com.intellij.ide; import com.intellij.concurrency.JobScheduler; +import com.intellij.diagnostic.VMOptions; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.util.ExecUtil; import com.intellij.ide.util.PropertiesComponent; @@ -51,14 +52,11 @@ import javax.swing.*; import javax.swing.event.HyperlinkEvent; import java.awt.*; import java.io.File; -import java.lang.management.ManagementFactory; -import java.lang.management.RuntimeMXBean; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.util.List; public class SystemHealthMonitor implements ApplicationComponent { @@ -78,28 +76,21 @@ public class SystemHealthMonitor implements ApplicationComponent { @Override public void initComponent() { checkRuntime(); - checkVMoptions(); + checkReservedCodeCacheSize(); checkIBus(); checkSignalBlocking(); checkLauncherScript(); startDiskSpaceMonitoring(); } - private void checkVMoptions() { - RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); - List jvmArgs = runtimeMXBean.getInputArguments(); + private void checkReservedCodeCacheSize() { int minReservedCodeCacheSize = 240; - for (String arg : jvmArgs) { - if (arg.contains("-XX:ReservedCodeCacheSize=")) { - String vmOption = arg.substring(arg.lastIndexOf("=") + 1); - if (Integer.parseInt(vmOption.substring(0, vmOption.length() - 1)) < minReservedCodeCacheSize) { - showNotification(new KeyHyperlinkAdapter("vmoptions.warn.message"), vmOption, minReservedCodeCacheSize); - } - } + int reservedCodeCacheSize = VMOptions.readOption(VMOptions.MemoryKind.CODE_CACHE, true); + if (reservedCodeCacheSize < minReservedCodeCacheSize) { + showNotification(new KeyHyperlinkAdapter("vmoptions.warn.message"), reservedCodeCacheSize, minReservedCodeCacheSize); } } - private void checkRuntime() { if (StringUtil.endsWithIgnoreCase(System.getProperty("java.version", ""), "-ea")) { showNotification(new KeyHyperlinkAdapter("unsupported.jvm.ea.message")); diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties index 96bb792a76f4..0ae819ae0669 100644 --- a/platform/platform-resources-en/src/messages/IdeBundle.properties +++ b/platform/platform-resources-en/src/messages/IdeBundle.properties @@ -1158,8 +1158,8 @@ FileChooser.refreshActionLabelText=Refresh browsers.settings=Web Browsers updates.check.period.on.exit=On every exit -vmoptions.warn.message=ReservedCodeCacheSize is too low: {0}. \ -Please increase it up to {1} to avoid performance degradation. \ +vmoptions.warn.message=ReservedCodeCacheSize is too low: {0}m. \ +Please increase it up to {1}m to avoid performance degradation. \ You could do it by "Help|Edit Custom VM Options..". unsupported.jvm.ea.message=Early Access Java versions may cause compatibility issues. Please use stable release.