platform: added warning about not enough memory for ReservedCodeCacheSize

IDEA-155626 CPU at 100% when just editing files caused by the migrated -XX:ReservedCodeCacheSize=96m JVM option
This commit is contained in:
Vladimir.Orlov
2017-07-20 16:46:44 +03:00
parent 654fb1be80
commit 6f5ea99dd9
2 changed files with 24 additions and 0 deletions
@@ -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<String> 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"));
@@ -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 <a href="switch">switch</a> 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