-
Bug
-
Resolution: Fixed
-
P3
-
fx2.1
There is 38% (14 Mb) Controls.ListView-Keyboard max memory usage regression in fx2.1-b02 comparing to fx2.1-b01:
2.0.2-b08: 38,152.8 ± 14.31
2.1.0-b01: 38,299.4 ± 217.35
2.1.0-b02: 52,753.2 ± 10,404.89 38% (14,453.8)
Heap dump analysis shows that ListView objects are not garbage collected anymore as they are
referenced from com.sun.javafx.scene.control.behavior.ListCellBehavior:map which contains
<ListView, Integer> pairs. As result the number of ListView objects is increased on each
benchmark iterations which leads to memory usage growth.
Mercurial history shows the following changes there integrated into fx2.1-b02:
changeset: 21:58baf681db5fparent: 19:7eca5d9be34e
user: Jonathan Giles
date: Mon Nov 14 15:04:53 2011 +1000
summary:RT-16565: TreeView: wrong return of treeView.getSelectionModel().getSelectedItem()
changeset: 18:fe5bebec5239
parent: 16:1d239e8dda08
user: Jonathan Giles
date: Sat Nov 12 09:01:37 2011 +1000
summary: Fix for performance regressionRT-17926. Comes at the cost of reopening issue RT-16565 which will need to be fixed in an alternative way.
changeset: 14:fe98e4ce9d6f
user: Jonathan Giles
date: Sat Nov 12 08:12:48 2011 +1000
summary:RT-17735: [ListView] Anchor is not updated, when element is added on its position
> hg diff -r fe98e4ce9d6f -r 58baf681db5f ./javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ListCellBehavior.java
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ListCellBehavior.java Sat Nov 12 08:12:48 2011 +1000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ListCellBehavior.java Mon Nov 14 15:04:53 2011 +1000
@@ -53,39 +53,17 @@
}
static void setAnchor(ListView list, int anchor) {
- map.put(list, anchor);
+ if (list != null && anchor < 0) {
+ map.remove(list);
+ } else {
+ map.put(list, anchor);
+ }
}
-
-// private ListChangeListener<Integer> selectedIndicesListener = new ListChangeListener<Integer>() {
-// @Override public void onChanged(ListChangeListener.Change c) {
-// while (c.next()) {
-// // there are no selected items, so lets clear out the anchor
-// if (c.getList().isEmpty()) {
-// map.remove(getControl().getListView());
-// }
-// }
-// }
-// };
public ListCellBehavior(ListCell control) {
super(control);
-
-// // Fix forRT-16565
-// control.getListView().selectionModelProperty().addListener(new ChangeListener<MultipleSelectionModel>() {
-// @Override public void changed(ObservableValue observable, MultipleSelectionModel oldValue, MultipleSelectionModel newValue) {
-// if (oldValue != null) {
-// oldValue.getSelectedIndices().removeListener(selectedIndicesListener);
-// }
-// if (newValue != null) {
-// newValue.getSelectedIndices().addListener(selectedIndicesListener);
-// }
-// }
-// });
-// if (control.getListView().getSelectionModel() != null) {
-// control.getListView().getSelectionModel().getSelectedIndices().addListener(selectedIndicesListener);
-// }
}
-
+
@Override public void mousePressed(MouseEvent e) {
// Note that list.select will reset selection
// for out of bounds indexes. So, need to check
2.0.2-b08: 38,152.8 ± 14.31
2.1.0-b01: 38,299.4 ± 217.35
2.1.0-b02: 52,753.2 ± 10,404.89 38% (14,453.8)
Heap dump analysis shows that ListView objects are not garbage collected anymore as they are
referenced from com.sun.javafx.scene.control.behavior.ListCellBehavior:map which contains
<ListView, Integer> pairs. As result the number of ListView objects is increased on each
benchmark iterations which leads to memory usage growth.
Mercurial history shows the following changes there integrated into fx2.1-b02:
changeset: 21:58baf681db5fparent: 19:7eca5d9be34e
user: Jonathan Giles
date: Mon Nov 14 15:04:53 2011 +1000
summary:
changeset: 18:fe5bebec5239
parent: 16:1d239e8dda08
user: Jonathan Giles
date: Sat Nov 12 09:01:37 2011 +1000
summary: Fix for performance regression
changeset: 14:fe98e4ce9d6f
user: Jonathan Giles
date: Sat Nov 12 08:12:48 2011 +1000
summary:
> hg diff -r fe98e4ce9d6f -r 58baf681db5f ./javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ListCellBehavior.java
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ListCellBehavior.java Sat Nov 12 08:12:48 2011 +1000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ListCellBehavior.java Mon Nov 14 15:04:53 2011 +1000
@@ -53,39 +53,17 @@
}
static void setAnchor(ListView list, int anchor) {
- map.put(list, anchor);
+ if (list != null && anchor < 0) {
+ map.remove(list);
+ } else {
+ map.put(list, anchor);
+ }
}
-
-// private ListChangeListener<Integer> selectedIndicesListener = new ListChangeListener<Integer>() {
-// @Override public void onChanged(ListChangeListener.Change c) {
-// while (c.next()) {
-// // there are no selected items, so lets clear out the anchor
-// if (c.getList().isEmpty()) {
-// map.remove(getControl().getListView());
-// }
-// }
-// }
-// };
public ListCellBehavior(ListCell control) {
super(control);
-
-// // Fix for
-// control.getListView().selectionModelProperty().addListener(new ChangeListener<MultipleSelectionModel>() {
-// @Override public void changed(ObservableValue observable, MultipleSelectionModel oldValue, MultipleSelectionModel newValue) {
-// if (oldValue != null) {
-// oldValue.getSelectedIndices().removeListener(selectedIndicesListener);
-// }
-// if (newValue != null) {
-// newValue.getSelectedIndices().addListener(selectedIndicesListener);
-// }
-// }
-// });
-// if (control.getListView().getSelectionModel() != null) {
-// control.getListView().getSelectionModel().getSelectedIndices().addListener(selectedIndicesListener);
-// }
}
-
+
@Override public void mousePressed(MouseEvent e) {
// Note that list.select will reset selection
// for out of bounds indexes. So, need to check