Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Unregistering images when closing the diagram editor
Unregistering images when closing the diagram editor [message #648621] Thu, 13 January 2011 17:18 Go to next message
Shenxue Zhou is currently offline Shenxue Zhou
Messages: 50
Registered: July 2009
Member
There seems no way to un-register images when closing diagram editor. DiagramEditorInternal's dispose() method would call ConfigurationProvider's dispose() method which in turn calls DiagramTypeProvider's dispose() method. But I've not found any direct/indirect references to the image provider during diagram editor's dispose call.

In fact, I experimented with setting a break point on the constructor of my image provider. If I closed my diagram editor and re-opened it, I didn't get a break on the image provider's constructor. So the image provider is only initialized once and being held on to even after the diagram editor is disposed. This seems to be memory leaks.

Any idea on what's going on here?

Thanks!

Shenxue
Re: Unregistering images when closing the diagram editor [message #648721 is a reply to message #648621] Fri, 14 January 2011 08:50 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1618
Registered: July 2009
Location: Walldorf, Germany
Senior Member
For performance and memory consumption reasons we decided to hoold the image
provider at the diagram type and not at the editor instance. This has the
advantage that only for the first start of an editor for a certain diagram
type the images need to be loaded and all subsequent starts are faster.
Besides memory is only allocated once and not for each editor instance.

The downside is of course that the images stay in memory after closing the
last editor, because the framework cannot tell if the user will open another
diagram editor of this kind in the future or not. If you see this as a bug,
please open a bugzilla for that.

Michael


"Shenxue Zhou" <shenxue.zhou@oracle.com> wrote in message
news:ignbqq$b8k$1@news.eclipse.org...
> There seems no way to un-register images when closing diagram editor.
> DiagramEditorInternal's dispose() method would call
> ConfigurationProvider's dispose() method which in turn calls
> DiagramTypeProvider's dispose() method. But I've not found any
> direct/indirect references to the image provider during diagram editor's
> dispose call.
> In fact, I experimented with setting a break point on the constructor of
> my image provider. If I closed my diagram editor and re-opened it, I
> didn't get a break on the image provider's constructor. So the image
> provider is only initialized once and being held on to even after the
> diagram editor is disposed. This seems to be memory leaks.
>
> Any idea on what's going on here?
>
> Thanks!
>
> Shenxue
Re: Unregistering images when closing the diagram editor [message #648848 is a reply to message #648621] Fri, 14 January 2011 17:39 Go to previous message
Shenxue Zhou is currently offline Shenxue Zhou
Messages: 50
Registered: July 2009
Member
I've opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=334402 to track this issue. I believe it's a good programming practice to release all the memories upon closing the editor.
Previous Topic:Graphiti releases download site url format
Next Topic:Create object on dropping connection to diagram
Goto Forum:
  


Current Time: Wed Oct 22 23:19:48 GMT 2014

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

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