mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use console buffer in log (EA-31165 - OOME: LogConsoleBase.addMessage)
This commit is contained in:
@@ -18,6 +18,7 @@ package com.intellij.diagnostic.logging;
|
||||
|
||||
import com.intellij.execution.filters.TextConsoleBuilder;
|
||||
import com.intellij.execution.filters.TextConsoleBuilderFactory;
|
||||
import com.intellij.execution.impl.ConsoleBuffer;
|
||||
import com.intellij.execution.impl.ConsoleViewImpl;
|
||||
import com.intellij.execution.process.ProcessAdapter;
|
||||
import com.intellij.execution.process.ProcessEvent;
|
||||
@@ -370,6 +371,13 @@ public abstract class LogConsoleBase extends AdditionalTabComponent implements L
|
||||
if (editor != null) {
|
||||
myOriginalDocument = new StringBuffer(editor.getDocument().getText());
|
||||
}
|
||||
} else {
|
||||
if (ConsoleBuffer.useCycleBuffer()) {
|
||||
final int toRemove = myOriginalDocument.length() - ConsoleBuffer.getCycleBufferSize();
|
||||
if (toRemove > 0) {
|
||||
myOriginalDocument.delete(0, toRemove);
|
||||
}
|
||||
}
|
||||
}
|
||||
return myOriginalDocument;
|
||||
}
|
||||
|
||||
@@ -119,12 +119,12 @@ public class ConsoleBuffer {
|
||||
myContentTypesToNotStripOnCycling.add(ConsoleViewContentType.USER_INPUT);
|
||||
}
|
||||
|
||||
private static boolean useCycleBuffer() {
|
||||
public static boolean useCycleBuffer() {
|
||||
final String useCycleBufferProperty = System.getProperty("idea.cycle.buffer.size");
|
||||
return useCycleBufferProperty == null || !"disabled".equalsIgnoreCase(useCycleBufferProperty);
|
||||
}
|
||||
|
||||
private static int getCycleBufferSize() {
|
||||
public static int getCycleBufferSize() {
|
||||
final String cycleBufferSizeProperty = System.getProperty("idea.cycle.buffer.size");
|
||||
if (cycleBufferSizeProperty == null) return 1024 * 1024;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user