Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » IOConsole causes Out Of Memory / Heap Space when writing large logs
IOConsole causes Out Of Memory / Heap Space when writing large logs [message #1184545] Wed, 13 November 2013 14:27 Go to next message
Maurice Okunek is currently offline Maurice OkunekFriend
Messages: 7
Registered: August 2010
Junior Member
Hi,

basically i'm using some kind of a pop-up MessageConsole that will show ALL output that is generated in Eclipse (via Eclipse Console View in the UI). Our tool will process large amounts of data, each data will be shown in the console.

So let me show exactly what I have done and how to reproduce the error:

1) Pipe output streams to a custom console (via Custom Plugin):

// Create the DIS Console for InEn ETL and generic Output.
mDisConsole = findConsole("DISConsole");
MessageConsoleStream out = mDisConsole.newMessageStream();
		
BufferedOutputStream bout = new BufferedOutputStream(out);
		
// Register the DIS Console as standard output
if (out != null){
  mDisConsoleStream = new PrintStream(bout);
  System.setOut(mDisConsoleStream);
  System.setErr(mDisConsoleStream);
...		}


The BufferedOutputStream is just a test and changes nothing.

2) The custom MessageConsole is created in the following manner (All I have found as workarounds in the WWW are some parameter issues, no setting worked):

@Override
public void openConsole() {
  if (fConsole == null) {
    fConsole = new DISConsole();
    fConsole.setConsoleWidth(0);
    fConsole.setWaterMarks(0, 1000);
    fConsoleManager.addConsoles(new IConsole[] { fConsole });
  }
  fConsoleManager.showConsoleView(fConsole);
}


3) I start a WorkspaceJob which simply writes nonsense to the console via the out stream in its runInWorkspace method:

public IStatus runInWorkspace(final IProgressMonitor pMonitor) throws CoreException {
  boolean jobWasSuccessfull = true;
  startETLLog4J();

  String dummyLog = "Writing Obj_234235653223545\ngragerghraegbukjreaberrge\ngaergraegaergaergaer\ngaergaergaergergaegareg\ngaergeargergaergaegaerg\naegaregaergaergaerg\n\n\nefewafweewafawefawefewfweaf\nfweafwefwefwefweaf\nfweafwefwefwaefwaefweafawefwea\nfewafweafwaefwefwefawefwaefeawf\nfewafweafweafweafwaefawefweafwefwaef\nwefweafwaefwaefweafweaf\nwefwaefwaefwaefwea\nfewfwaefweafweafwaefawe\n\n\nfawefgawefawefwfawefawefeaw\nfewfwaefwaefwefwefwaef\nefawefawefawefawefwaefwaef\nwefwaefwaefawefwefweafaew\nefawefwaefawef\n\nDone.\n\n\n\n";

  for (int i = 0, j=0; i < 100000; i++,j++) {
    mETLLogger.error(dummyLog);
  }
  return new Status(IStatus.OK, DisCorePlugin.PLUGIN_ID, "OK");
}


This will cause an out of memory almost instantly (256m Xmx).
Not using a custom console and writing to the Development Eclipse Console does not cause that problems, the memory of the dev-Eclipse is barely touched.

I don't know what's the problem here, any advice?
Oh, btw.: There are several threads writing to the streams, don't know if this is a problem...

[Updated on: Wed, 13 November 2013 14:28]

Report message to a moderator

Re: IOConsole causes Out Of Memory / Heap Space when writing large logs [message #1186117 is a reply to message #1184545] Thu, 14 November 2013 13:43 Go to previous message
Maurice Okunek is currently offline Maurice OkunekFriend
Messages: 7
Registered: August 2010
Junior Member

The problem has been solved, please ignore this thread.

Note to me: Don't be too confident about thinking that code gets definitly called, at least make sure once that it gets called Embarrassed

My setting for the watermarks were not called, therefore no limit exist which lead to an out of memory.

The following settings worked perfectly for me even if pumping the console full with massive output:

e.g.:
myConsole.setConsoleWidth(0);
myConsole.setWaterMarks(2000, 4000);

Sorry if anybody has tested that.
Previous Topic:ExtensionContributionFactory toolbar contributions
Next Topic:I have a MultiEditor example
Goto Forum:
  


Current Time: Thu Apr 25 10:05:32 GMT 2024

Powered by FUDForum. Page generated in 0.03163 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top