Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Model and Notation is still in the memory after diagram is closed
Model and Notation is still in the memory after diagram is closed [message #209117] Tue, 21 October 2008 21:02 Go to next message
Eclipse UserFriend
Originally posted by: mklinchin.yahoo.com

Hello,

When I close GMF diagram all objects from model and from notation
(DiagramImpl, etc) are still in the memory. When I open the diagram again,
the number of these objects double. I monitor objects and memory using
"jconsole" and "jmap -histo:live". How can I let both Notation and Model
go after diagram is closed?

I have dispose() method generated in my XxxDocumentProvider that calls
unload to both notation and model resources. It seems that something still
holds a reference to either model or notation somewhere.

Thank you,
Igor
Re: Model and Notation is still in the memory after diagram is closed [message #209337 is a reply to message #209117] Thu, 23 October 2008 21:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mklinchin.yahoo.com

After some debugging I realized that the whole XxxDiagramEditor does not
get de-allocated after editor gets closed. Probably, it holds references
to other model and notation objects. Each time when I open editor I get
new instance of XxxDiagramEditor while the previos one stays in the memory.

I tried to avoid providing DocumentProvider to the editor but the result
is the same - there are no model / notation objects but the editor still
stays in the memory.

I found several articles about it in this newsgroup but all of them are
with no resolution. I would appreciate any idea about how to troubleshoot
this situation.

Thank you,
Igor

On Tue, 21 Oct 2008 17:02:43 -0400, Igor Klinchin wrote:

> Hello,
>
> When I close GMF diagram all objects from model and from notation
> (DiagramImpl, etc) are still in the memory. When I open the diagram again,
> the number of these objects double. I monitor objects and memory using
> "jconsole" and "jmap -histo:live". How can I let both Notation and Model
> go after diagram is closed?
>
> I have dispose() method generated in my XxxDocumentProvider that calls
> unload to both notation and model resources. It seems that something still
> holds a reference to either model or notation somewhere.
>
> Thank you,
> Igor
Re: Model and Notation is still in the memory after diagram is closed [message #209407 is a reply to message #209337] Fri, 24 October 2008 09:31 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Igor,

> After some debugging I realized that the whole XxxDiagramEditor does
> not get de-allocated after editor gets closed. Probably, it holds
How did you determine that?

-----------------
Alex Shatalin
Re: Model and Notation is still in the memory after diagram is closed [message #209471 is a reply to message #209407] Fri, 24 October 2008 14:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mklinchin.yahoo.com

Hi Alex,

I do

jmap histo:live $PID | grep XxxDiagramEditor

I open diagram like this:

workbenchPage.openEditor(editorInput, XxxDiagramEditor.ID);

then I close it and do jmap that shows XxxDiagramEditor in the memory. All
consequent open / close increase number of editors. Using this way I can
also see all my model and notation objects too. It all started with
jconsole that indicated memory increase in this situation so I started to
monitor what exactly stays in the memory.

Thank you for your reply, I kind of stuck here even with ideas how to
troubleshoot it. Igor

On Fri, 24 Oct 2008 09:31:44 +0000, Alex Shatalin wrote:

> Hello Igor,
>
>> After some debugging I realized that the whole XxxDiagramEditor does
>> not get de-allocated after editor gets closed. Probably, it holds
> How did you determine that?
>
> -----------------
> Alex Shatalin
Re: Model and Notation is still in the memory after diagram is closed [message #209478 is a reply to message #209471] Fri, 24 October 2008 19:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mklinchin.yahoo.com

Here is an interesting update. When I open a diagram without Property View
displayed on the screen then diagram close de-allocates editor and all
objects - there is no leak. If I open a diagram while property view is
visible or I open porperty view when diagram is opened then diagram close
will leave XxxDiagramEditor with model and notation objects. So it seems
that it is Property Sheet keeps reference to something in the editor. How
can I troubleshoot this?

Thank you,
Igor

On Fri, 24 Oct 2008 10:19:42 -0400, Igor Klinchin wrote:

> Hi Alex,
>
> I do
>
> jmap histo:live $PID | grep XxxDiagramEditor
>
> I open diagram like this:
>
> workbenchPage.openEditor(editorInput, XxxDiagramEditor.ID);
>
> then I close it and do jmap that shows XxxDiagramEditor in the memory. All
> consequent open / close increase number of editors. Using this way I can
> also see all my model and notation objects too. It all started with
> jconsole that indicated memory increase in this situation so I started to
> monitor what exactly stays in the memory.
>
> Thank you for your reply, I kind of stuck here even with ideas how to
> troubleshoot it. Igor
>
> On Fri, 24 Oct 2008 09:31:44 +0000, Alex Shatalin wrote:
>
>> Hello Igor,
>>
>>> After some debugging I realized that the whole XxxDiagramEditor does
>>> not get de-allocated after editor gets closed. Probably, it holds
>> How did you determine that?
>>
>> -----------------
>> Alex Shatalin
Re: Model and Notation is still in the memory after diagram is closed [message #209502 is a reply to message #209478] Sat, 25 October 2008 03:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mklinchin.yahoo.com

Hello again,

I think that I found the place that leaks. It is
XxxSheetLabelProvider. At some point there are two listeners added to
its AdapterFactoryLabelProvider but only one gets removed. Ultimately, it
keeps references to model, notation and to the editor too. Inheriting this
class from LabelProvider instead of DecoratingLabelProvider eliminates the
leak but titles of properties view become unformatted.

I found the post with subject "Re: AdapterFactoryLabelProvider, GMF and
memory leak" in this group with the recomendation to call dispose to
provider. It is not that easy to do since the provide is defined as
private in parent class.

I added this method to my generated XxxSheetLabelProvider:

@Override
public void removeListener(ILabelProviderListener listener) {
super.removeListener(listener);
dispose();
}

It eliminates the leak perfectly when I open and then close the diagram
but when I open the diagram, refresh its content (if file gets changed
by some other application) and then close it, this XxxSheetLabelProvider
class is still in memory together with editor, mode and notation (and the
leak too). I feel that I am close to the clean solution. Had anyone saw
similar situation? How to clean up it correctly?

This is the code how I refresh the diagram:

editor.setInput(editor.getEditorInput());

Thank you,
Igor


On Fri, 24 Oct 2008 15:45:34 -0400, Igor Klinchin wrote:

> Here is an interesting update. When I open a diagram without Property View
> displayed on the screen then diagram close de-allocates editor and all
> objects - there is no leak. If I open a diagram while property view is
> visible or I open porperty view when diagram is opened then diagram close
> will leave XxxDiagramEditor with model and notation objects. So it seems
> that it is Property Sheet keeps reference to something in the editor. How
> can I troubleshoot this?
>
> Thank you,
> Igor
>
> On Fri, 24 Oct 2008 10:19:42 -0400, Igor Klinchin wrote:
>
>> Hi Alex,
>>
>> I do
>>
>> jmap histo:live $PID | grep XxxDiagramEditor
>>
>> I open diagram like this:
>>
>> workbenchPage.openEditor(editorInput, XxxDiagramEditor.ID);
>>
>> then I close it and do jmap that shows XxxDiagramEditor in the memory. All
>> consequent open / close increase number of editors. Using this way I can
>> also see all my model and notation objects too. It all started with
>> jconsole that indicated memory increase in this situation so I started to
>> monitor what exactly stays in the memory.
>>
>> Thank you for your reply, I kind of stuck here even with ideas how to
>> troubleshoot it. Igor
>>
>> On Fri, 24 Oct 2008 09:31:44 +0000, Alex Shatalin wrote:
>>
>>> Hello Igor,
>>>
>>>> After some debugging I realized that the whole XxxDiagramEditor does
>>>> not get de-allocated after editor gets closed. Probably, it holds
>>> How did you determine that?
>>>
>>> -----------------
>>> Alex Shatalin
Re: Model and Notation is still in the memory after diagram is closed [message #209611 is a reply to message #209502] Mon, 27 October 2008 12:30 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Igor,

AFAIKSee in the CVS HEAD generator was recently (16.07.2008) changed to generate
a little bit different LabelProvider implementation. From now generated Labelprovider
extends org.eclipse.jface.viewers.BaseLabelProvider and contains no listeners
(as a side effect there can be some problems with label update i suppose ;-))

In any case, i suggest you to try one of the latest GMF builds from HEAD
stream to see if this problem still present there since corresponding template
was significantly changed.
Thank you for your investigations and do not hesitate to file a bugzilla
entry if you found new code generator templates are working incorrectly/still
leads us to a memory leaks.

-----------------
Alex Shatalin
Previous Topic:Disable label editor for newly inserted symbols
Next Topic:Use GMF Editor without file system backend
Goto Forum:
  


Current Time: Sat Jan 23 06:04:37 GMT 2021

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

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

Back to the top