diff --git a/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java b/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java index 8a016f8a7fd1..b823bc08232b 100644 --- a/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java +++ b/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java @@ -51,11 +51,15 @@ 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 { private static final Logger LOG = Logger.getInstance(SystemHealthMonitor.class); @@ -74,12 +78,28 @@ public class SystemHealthMonitor implements ApplicationComponent { @Override public void initComponent() { checkRuntime(); + checkVMoptions(); checkIBus(); checkSignalBlocking(); checkLauncherScript(); startDiskSpaceMonitoring(); } + private void checkVMoptions() { + RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); + List jvmArgs = runtimeMXBean.getInputArguments(); + 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); + } + } + } + } + + 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 609d748e59ea..96bb792a76f4 100644 --- a/platform/platform-resources-en/src/messages/IdeBundle.properties +++ b/platform/platform-resources-en/src/messages/IdeBundle.properties @@ -1158,6 +1158,10 @@ 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. \ +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. outdated.jvm.version.message1=IDE''s Java runtime ({0}) is outdated - this may cause stability issues. Please update to {1} or newer, or switch to the bundled Java runtime outdated.jvm.version.message2=IDE''s Java runtime ({0}) is outdated - this may cause stability issues. Please update to {1} or newer