Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8114519

TableView data keep references to TableViews even they don't exist any more.

XMLWordPrintable

      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.

        1. memory_leak_improvements_1.jpg
          memory_leak_improvements_1.jpg
          34 kB
        2. remaining_problem_suspects.jpg
          remaining_problem_suspects.jpg
          121 kB
        3. screenshot-1.jpg
          screenshot-1.jpg
          160 kB
        4. TableColumn_visible_property_leak.jpg
          TableColumn_visible_property_leak.jpg
          361 kB
        5. tableview_memleak.JPG
          tableview_memleak.JPG
          219 kB
        6. TableViewMemTest.java
          5 kB
        7. TableViewMemTest.java.v02
          7 kB

            jgiles Jonathan Giles
            epavlova Ekaterina Pavlova
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: