Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Editors leaks memory after close?(It seems eclipse keeps reference to closed editors which consumes pretty much memory)
Editors leaks memory after close? [message #1797708] Mon, 05 November 2018 13:39 Go to next message
M. J. is currently offline M. J.Friend
Messages: 6
Registered: September 2018
Junior Member
Hello,

we are developing IDE based on eclipse (Eclipse RCP application). Our IDE contains primarly custom text-files editor, plus some other extensions.

We have been notified by our users that after some work our IDE crashes because of no memory avaible. I have done some investigations and found out, that after some work, memory consumed by our editor(s) increases up to 10MB (and more).

This is okay, since the the editor needs some memory and during work with it it allocates more and more. Strange behaviour happens, when the editor is closed. I assumed the memory will be "freed" (unallocated) when the editor is closed, but it isn't. Some pieces of the memory of the editor still remains in the memory untouched.

I have performed some memory analysis using jmap and Eclipse MAT and found out that it is really the editor (instance of StructuredTextEditor) which consumes the memory. To make sure it is not problem within our editor I did simillar - I opened XML file with plain eclipse xml editor, made the file quite huge (25k+ lines of quite dense XML content), saved and closed. After the close, there still remains more than 10MB unallocated (and, for instance, 35MB of ElementNSImpl instances). See attached MAT report:

index.php/fa/34237/0/


My first question is - is it bug or feature? Is it some sort of cache, or the real memory leak? My second question - is there some way how to get rid of this unused memory from the developper side - other than tell users to restart the whole eclipse? For instance, use somehow weak references? I was trying to google it - but try to google "eclipse memory leak".

Thanks,

Martin
Re: Editors leaks memory after close? [message #1797748 is a reply to message #1797708] Tue, 06 November 2018 06:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
From past experience with editor memory leaks, it seems to me that Eclipse will often leak, temporarily, the most recently closed editor instance until you (the user) select something else in the workspace. In the end though, you need a tool that will show you specifically what causes the leak. E.g., I use YourKit for that purpose. Only in this way you can figure out what you need to do to fix the leak or how to report a bug via Bugzilla as something Eclipse itself causes. Your HTML reports suggest that perhaps the WebTools editor adds a listener to the workspace but doesn't remove it when the editor is disposed.

E.g., EMF's generated editor does this:
  public void init(IEditorSite site, IEditorInput editorInput)
  {
...   
   ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
  }
And unless it also does the following, it will leak editors:
  @Override
  public void dispose()
  {
    ...
    ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Editors leaks memory after close? [message #1797818 is a reply to message #1797748] Tue, 06 November 2018 21:07 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

Until you know why that memory is still being used, you won't know whether it's a bug or a
feature. So, does it also happen with the HTML and CSS editors (which use the same
StructuredTextEditor class, but not in a MultiPageEditorPart)? Can you see what's pointing
to those objects left in memory?

This would probably be better pursued in a bug report, btw.


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:Why is "Preference AND Property page" not standard API?
Next Topic:Find Next in console view and other places
Goto Forum:
  


Current Time: Thu Apr 25 20:26:35 GMT 2024

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

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

Back to the top