TestFX
TestFX copied to clipboard
Remove Application from ParametersImpl
After we ported our tests from 3.x to 4.0.15 we are running sometimes into memory problems. I think the problem is that the Application is registered each time in ParametersImpl and is never removed. So the GC can never remove the test classes from the memory. Our current workaround is to remove the Application via Reflection from ParametersImpl:
public static void clearApplication() {
try {
final Field f = ParametersImpl.class.getDeclaredField("params");
f.setAccessible(true);
final Map<Application, Parameters> params = (Map<Application, Parameters>) f.get(null);
params.clear();
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
}
}
Running with JUnit 4, Java 8
Would you be open to submitting a pull request?