-
Bug
-
Resolution: Fixed
-
P3
-
fx2.0
Ensemble application has at least 3 memory leaks.
The test tests/performance/Ensemble2AutoTest fails with OutOfMemory after ~96 iterations
when running with default heap size (256mb).
Running the test with -Xmx24m causes OOM after 6 iterations.
Ensemble2AutoTest test works as following.
It loops through the list of Samples and launch them by simulating "click" on the sample.
Analysis of heap dump files shows that memory leaks are in following samples:
1) TableSample
new TableSample object is created every time we click in TableSample page.
TableSamples (and linked objects) objects are kept alive and as result are not collected by GC
because of "static List<TableColumn> observingColumns" in TableView class.
Running Ensemble2AutoTest with skipped TableSample and -Xmx24m increase the number of successful
iterations from 6 to 11.
2) InterpolatorSample
InterpolatorSample creates ans starts 5 timelines with Timeline.INDEFINITE cycle.
However, these timelines are never stopped and as result creating new InterpolatorSample
object initiates 5 more timelines/threads every time we click on InterpolatorSample page.
3) TimelineEventsSample
This sample creates and starts AnimationTimer which is never stopped.
Note, new Sample objects are created every time we click on Sample page because of
following code in Ensemble pages/SamplePage.java:createView
final Sample sample = (Sample)sampleClass.newInstance();
To fix memory leak in InterpolatorSample it seems to be enough to implement stop method
and stop all created timelines.
To fix memory leak in TimelineEventsSample "Animation timer" also needs to be stopped in addition to timeline.
Otherwise the link to this timer is kept in static AbstractMasterTimer:emptyAnimationTimers[].
Perhaps it will be better to don't create new Sample objects every time we click on Sample page.
However this perhaps require Ensemble redesign.
Anyway, all these memory leaks needs to be solved as OOM could occur pretty quickly even with default heap size.
The test tests/performance/Ensemble2AutoTest fails with OutOfMemory after ~96 iterations
when running with default heap size (256mb).
Running the test with -Xmx24m causes OOM after 6 iterations.
Ensemble2AutoTest test works as following.
It loops through the list of Samples and launch them by simulating "click" on the sample.
Analysis of heap dump files shows that memory leaks are in following samples:
1) TableSample
new TableSample object is created every time we click in TableSample page.
TableSamples (and linked objects) objects are kept alive and as result are not collected by GC
because of "static List<TableColumn> observingColumns" in TableView class.
Running Ensemble2AutoTest with skipped TableSample and -Xmx24m increase the number of successful
iterations from 6 to 11.
2) InterpolatorSample
InterpolatorSample creates ans starts 5 timelines with Timeline.INDEFINITE cycle.
However, these timelines are never stopped and as result creating new InterpolatorSample
object initiates 5 more timelines/threads every time we click on InterpolatorSample page.
3) TimelineEventsSample
This sample creates and starts AnimationTimer which is never stopped.
Note, new Sample objects are created every time we click on Sample page because of
following code in Ensemble pages/SamplePage.java:createView
final Sample sample = (Sample)sampleClass.newInstance();
To fix memory leak in InterpolatorSample it seems to be enough to implement stop method
and stop all created timelines.
To fix memory leak in TimelineEventsSample "Animation timer" also needs to be stopped in addition to timeline.
Otherwise the link to this timer is kept in static AbstractMasterTimer:emptyAnimationTimers[].
Perhaps it will be better to don't create new Sample objects every time we click on Sample page.
However this perhaps require Ensemble redesign.
Anyway, all these memory leaks needs to be solved as OOM could occur pretty quickly even with default heap size.