Model and Notation is still in the memory after diagram is closed [message #209117] |
Tue, 21 October 2008 17: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 #209478 is a reply to message #209471] |
Fri, 24 October 2008 15: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] |
Fri, 24 October 2008 23: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
|
|
|
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 08:30  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.08918 seconds