Model and Notation is still in the memory after diagram is closed [message #209117] |
Tue, 21 October 2008 21:02 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 #209471 is a reply to message #209407] |
Fri, 24 October 2008 14:19 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.06667 seconds