Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366589 - XtextRunner caches InjectorProviders
Summary: XtextRunner caches InjectorProviders
Status: CLOSED WORKSFORME
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.2.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-13 13:03 EST by Benjamin Schwertfeger CLA
Modified: 2017-09-19 17:52 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Schwertfeger CLA 2011-12-13 13:03:23 EST
The XtextRunner caches all InjectorProvider in a static variable.

If your InjectorProvider has a state, like the Injector or the GlobalStateMemento, this leads to growing memory consumption if you call many tests in one JVM. The possibility of side effects between tests in this case is also higher, because you could get an InjectorProvider from a test which ran before.

The InjectorProvider should not be cached over different TestClasses or get a method, like AfterClass in JUnit, to be able to clean the internal state.
Comment 1 Sven Efftinge CLA 2011-12-13 13:36:06 EST
The idea is to reuse the injector to speed up execution. As it is a provider, you could have an implementation which doesn't hold the injector internally, but create a fresh one each time getInjector() is called.

Doesn't that work for you?
Comment 2 Sven Efftinge CLA 2011-12-15 07:24:52 EST
please reopen, if I missed something
Comment 3 Karsten Thoms CLA 2017-09-19 17:41:33 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 4 Karsten Thoms CLA 2017-09-19 17:52:40 EDT
Closing all bugs that were set to RESOLVED before Neon.0