-
Bug
-
Resolution: Fixed
-
P2
-
fx2.0
TableView data (of type ObservableList) keeps references to TableViews even they don't exist any more.
As result this causes OOM pretty quickly.
The test which creates static table data of size 30x150 and then creates new TableView object
on each iteration fails with OOM after 15 iterations. The default heap size was 256 Mb.
The test fails after 4 iterations in case heap size is specified to 64Mb.
The test case is attached. It works as following.
- creates static table data of size 30x150
static ObservableList<List<Double>> staticTableData;
- creates static table columns
static List<TableColumn> staticCols;
- creates the root group of the scene
rootGroup = new Group();
...
- on N'th iteration removes TableView_n-1, creates TableView_n
while (iters > 0) {
TableView tableView;
tableView.getColumns().addAll(staticCols);
tableView.setItems(staticTableData);
if (rootGroup.getChildren().size() == 1) {
rootGroup.getChildren().remove(0);
}
rootGroup.getChildren().add(0, tableView);
}
Please see tableview_memleak.jpg to see that staticTableData.observers keeps links
to all created during the test TableView specific objects.
It looks like that observers are not notified to delete the reference to observable objects
for some reason.
Perhaps there are more memory leaks in TableView but this is the first one which can be easy seen.
As result this causes OOM pretty quickly.
The test which creates static table data of size 30x150 and then creates new TableView object
on each iteration fails with OOM after 15 iterations. The default heap size was 256 Mb.
The test fails after 4 iterations in case heap size is specified to 64Mb.
The test case is attached. It works as following.
- creates static table data of size 30x150
static ObservableList<List<Double>> staticTableData;
- creates static table columns
static List<TableColumn> staticCols;
- creates the root group of the scene
rootGroup = new Group();
...
- on N'th iteration removes TableView_n-1, creates TableView_n
while (iters > 0) {
TableView tableView;
tableView.getColumns().addAll(staticCols);
tableView.setItems(staticTableData);
if (rootGroup.getChildren().size() == 1) {
rootGroup.getChildren().remove(0);
}
rootGroup.getChildren().add(0, tableView);
}
Please see tableview_memleak.jpg to see that staticTableData.observers keeps links
to all created during the test TableView specific objects.
It looks like that observers are not notified to delete the reference to observable objects
for some reason.
Perhaps there are more memory leaks in TableView but this is the first one which can be easy seen.