-
Bug
-
Resolution: Fixed
-
P3
-
8u66
-
x86
-
linux
FULL PRODUCT VERSION :
1.8.0_65
A DESCRIPTION OF THE PROBLEM :
When updating a StackedBarChart by removing series and adding new ones, all the memory is not correctly freed. The VisualVM shows a growing number of StackPane instances.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
launch the given test application
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.chart.BarChart;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.StackedBarChart;
import javafx.scene.chart.XYChart.*;
import javafx.stage.Stage;
import javafx.util.Duration;
public class ChartUpdate extends Application {
private int clock;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
CategoryAxis xAxis = new CategoryAxis();
NumberAxis yAxis = new NumberAxis(0, 100, 10);
yAxis.setAutoRanging(false);
StackedBarChart<String, Number> graph = new StackedBarChart<>(xAxis, yAxis);
graph.setAnimated(false);
Series<String, Number> series = new Series<>();
graph.getData().add(series);
stage.setScene(new Scene(graph));
stage.show();
Timeline timeLine = new Timeline();
timeLine.getKeyFrames().add(
new KeyFrame(Duration.millis(200),
(e) -> {
ObservableList<Data<String, Number>> list = FXCollections.observableArrayList();
Series<String, Number> newSeries = new Series<>();
list.add(new Data<>("A", clock % 10));
list.add(new Data<>("B",(10 - clock )% 10));
newSeries.setData(list);
graph.getData().clear();
graph.getData().add(newSeries);
clock = (clock + 1) % 10;
}));
timeLine.setCycleCount(Animation.INDEFINITE);
timeLine.play();
}
}
---------- END SOURCE ----------
1.8.0_65
A DESCRIPTION OF THE PROBLEM :
When updating a StackedBarChart by removing series and adding new ones, all the memory is not correctly freed. The VisualVM shows a growing number of StackPane instances.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
launch the given test application
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.chart.BarChart;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.StackedBarChart;
import javafx.scene.chart.XYChart.*;
import javafx.stage.Stage;
import javafx.util.Duration;
public class ChartUpdate extends Application {
private int clock;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
CategoryAxis xAxis = new CategoryAxis();
NumberAxis yAxis = new NumberAxis(0, 100, 10);
yAxis.setAutoRanging(false);
StackedBarChart<String, Number> graph = new StackedBarChart<>(xAxis, yAxis);
graph.setAnimated(false);
Series<String, Number> series = new Series<>();
graph.getData().add(series);
stage.setScene(new Scene(graph));
stage.show();
Timeline timeLine = new Timeline();
timeLine.getKeyFrames().add(
new KeyFrame(Duration.millis(200),
(e) -> {
ObservableList<Data<String, Number>> list = FXCollections.observableArrayList();
Series<String, Number> newSeries = new Series<>();
list.add(new Data<>("A", clock % 10));
list.add(new Data<>("B",(10 - clock )% 10));
newSeries.setData(list);
graph.getData().clear();
graph.getData().add(newSeries);
clock = (clock + 1) % 10;
}));
timeLine.setCycleCount(Animation.INDEFINITE);
timeLine.play();
}
}
---------- END SOURCE ----------