Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Zombie EditorInputs
Zombie EditorInputs [message #531167] Tue, 04 May 2010 01:35 Go to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
While investigating a memory use issue in an RCP application, I noticed that the EditorInputs of closed editors were not being garbage-collected, thanks to a reference from an instance of org.eclipse.ui.internal.EditorHistory. How do I disable this "feature"?
Re: Zombie EditorInputs [message #531282 is a reply to message #531167] Tue, 04 May 2010 12:29 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Eric Jain wrote:
> While investigating a memory use issue in an RCP application, I noticed
> that the EditorInputs of closed editors were not being
> garbage-collected, thanks to a reference from an instance of
> org.eclipse.ui.internal.EditorHistory. How do I disable this "feature"?

You cannot (at least there's no API to do it, you'd have to go digging
through the internals).

IEditorInputs should be lightweight objects. From the javadoc: "
<code>IEditorInput</code> is a light weight descriptor of editor input,
like a file name but more abstract. It is not a model. It is a
description of the model source for an <code>IEditorPart</code>."

There's another note in there as well, but basically think java.io.File
(it's little more than a string path). If you put your model in there,
it will be held for all time and that's contra-indicated by the javadoc
for IEditorInput.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Zombie EditorInputs [message #531283 is a reply to message #531167] Tue, 04 May 2010 12:31 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Eric Jain wrote:
> While investigating a memory use issue in an RCP application, I noticed
> that the EditorInputs of closed editors were not being
> garbage-collected, thanks to a reference from an instance of
> org.eclipse.ui.internal.EditorHistory. How do I disable this "feature"?

Just as an aside, if your IEditorInput returns
org.eclipse.ui.IEditorInput.getPersistable() null it will not be added
to the history, and when your session restarts those editors will not be
re-materialized.

The framework still requires no model held in the IEditorInput.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Zombie EditorInputs [message #531408 is a reply to message #531283] Tue, 04 May 2010 18:50 Go to previous messageGo to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
Paul Webster wrote on Tue, 04 May 2010 08:31
Just as an aside, if your IEditorInput returns org.eclipse.ui.IEditorInput.getPersistable() null it will not be added to the history, and when your session restarts those editors will not be re-materialized.


The IEditorInput appears to be referenced from the EditorHistory despite returning null for getPersistable().

Quote:
The framework still requires no model held in the IEditorInput.


Thanks for pointing this out!
Re: Zombie EditorInputs [message #531413 is a reply to message #531408] Tue, 04 May 2010 19:05 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Eric Jain wrote:
> Paul Webster wrote on Tue, 04 May 2010 08:31
>> Just as an aside, if your IEditorInput returns
>> org.eclipse.ui.IEditorInput.getPersistable() null it will not be added
>> to the history, and when your session restarts those editors will not
>> be re-materialized.
>
>
> The IEditorInput appears to be referenced from the EditorHistory despite
> returning null for getPersistable().

maybe exists() should return false as well ... that might remove it from
the editor history on a refresh.

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Zombie EditorInputs [message #531437 is a reply to message #531413] Tue, 04 May 2010 21:16 Go to previous message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
Paul Webster wrote on Tue, 04 May 2010 15:05
maybe exists() should return false as well ... that might remove it from
the editor history on a refresh.


Doesn't seem to help: Looks like refresh() is only called from getItems(), which in turn is only called from ReopenEditorMenu, but this contribution is not part of the RCP application...
Previous Topic:Java Webstart on Mac OSX
Next Topic:How to retrieve Windows Cursor Style using SWT
Goto Forum:
  


Current Time: Thu Mar 28 15:16:48 GMT 2024

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

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

Back to the top