fixes for IDEA-CR-15226

This commit is contained in:
Egor.Ushakov
2016-11-01 12:25:52 +03:00
parent afa62a899d
commit 0b4990f75e
2 changed files with 14 additions and 6 deletions
@@ -19,6 +19,7 @@
*/
package com.intellij.debugger.jdi;
import com.intellij.Patches;
import com.intellij.debugger.engine.DebugProcess;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
@@ -333,12 +334,14 @@ public class VirtualMachineProxyImpl implements JdiTimer, VirtualMachineProxy {
LOG.info(e);
}
// Memory leak workaround, see IDEA-163334
TargetVM target = ReflectionUtil.getField(myVirtualMachine.getClass(), myVirtualMachine, TargetVM.class, "target");
if (target != null) {
Thread controller = ReflectionUtil.getField(target.getClass(), target, Thread.class, "eventController");
if (controller != null) {
controller.stop();
if (Patches.JDK_BUG_EVENT_CONTROLLER_LEAK) {
// Memory leak workaround, see IDEA-163334
TargetVM target = ReflectionUtil.getField(myVirtualMachine.getClass(), myVirtualMachine, TargetVM.class, "target");
if (target != null) {
Thread controller = ReflectionUtil.getField(target.getClass(), target, Thread.class, "eventController");
if (controller != null) {
controller.stop();
}
}
}
}
@@ -77,6 +77,11 @@ public class Patches {
*/
public static final boolean JDK_BUG_ID_8042123 = !SystemInfo.isJavaVersionAtLeast("1.8.0_40");
/**
* Enable workaround for jdk bug with leaking TargetVM.EventController, see IDEA-163334
*/
public static final boolean JDK_BUG_EVENT_CONTROLLER_LEAK = true;
/**
* JDK on Mac detects font style for system fonts based only on their name (PostScript name).
* This doesn't work for some fonts which don't use recognizable style suffixes in their names.