|
|
|
|
Re: Leaky injections [message #1589251 is a reply to message #1589157] |
Wed, 28 January 2015 10:22 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
I agree that
org.eclipse.emf.edit.ui.action.ValidateAction.selectionProvider is
write-only and so not used. Unfortunately it is protected and so has
been API ever since written 10 years ago. (The variable was write-only
in the first commit too). No Bugzilla seems to request it. But the
Sample Ecore Editor when editing Ecore files does not have this leak
problem, so I see no point in raising an EMF Bugzilla against
ValidateAction.selectionProvider that cannot even be considered until
EMF 3.0.
It is the extra complexity of injection that provokes the leakage since,
the e.g. InheritingState's infrastructure seems to reference via an
Initializer.creatingThread and a Runnable to the ValidateAction.
I found a State associated with the xxxJavaValidator that was a closer
JNI root, but I wasn't using the xxxJavaValidator, so I eliminated it
and moved on to the more distant JNI root in the screen shot.
My current thinking is that either the State is referencing more than it
should, or the State is not being shut down properly. The magic of
injection is indeed all magic to me, hence my query hoping for help from
someone who knows better.
(I tried a simpler repro, using injection and none of my code, by
opening a *.xtext with the Sample Reflective Ecore Editor. This used to
work and so allow a user to save the underlying model, but now Bug 458620.)
The shut down in EcoreEditor is certainly poor since the Resources are
not unloaded. To get OCL code to shutdown at all I had to register an
additional AdapterFactory so that there is an EcoreEditor.dispose call-back.
Bottom line. OCL Xtext-based code has an Injector-related leakage in the
Ecore Editor. Is it an OCL/Xtext/Injection/EcoreEditor bug? Maybe there
is some simple additional action that the EcoreEditor.dispose call-back
needs to do to break the injector references.
Regards
Ed Willink
On 28/01/2015 09:14, Sebastian Zarnekow wrote:
> Hi Ed,
>
> where does the xxxJavaValidator leak some state? Could you please
> point me into the right direction?
>
> From looking at the code, it's not entirely clear to me why the
> ValidateAction keeps a strong reference to the selection provider. Is
> it used somewhere? At least in my target platfrom, I cannot find a
> reference to it. Maybe that's a trace worthy to follow. Doesn't look
> like a DI or Xtext issue, though.
>
> Best,
> Sebastian
|
|
|
|
Powered by
FUDForum. Page generated in 0.02080 seconds