JDK-8242621 : TabPane: Memory leak when switching skin
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: jfx15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-04-14
  • Updated: 2021-01-07
  • Resolved: 2021-01-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx16Fixed
Related Reports
Blocks :  
Description
just to keep track, a failing test below.

Didn't dig, just verified that not/removing the listener to selectedItem in dispose (as suggested in fix for JDK-8241737) does not make a difference here.

    public static class TabPaneSkin1 extends TabPaneSkin {

        public TabPaneSkin1(TabPane control) {
            super(control);
        }
        
    }
    
    /**
     * memory leak when replacing skin
     */
    @Test
    public void testTabPaneSkin() {
        TabPane control = new TabPane();
        ObservableList<String> data = FXCollections.observableArrayList("Apple", "Orange", "Banana");
        data.forEach(text -> control.getTabs().add(new Tab(text)));
        showControl(control);
        WeakReference<?> weakRef = new WeakReference<>(control.getSkin());
        control.setSkin(new TabPaneSkin1(control));
        attemptGC(weakRef, 10);
        assertNull("skin must be gc'ed", weakRef.get());
    }
 
Comments
Changeset: c197b624 Author: Ambarish Rapte <arapte@openjdk.org> Date: 2021-01-07 03:18:57 +0000 URL: https://git.openjdk.java.net/jfx/commit/c197b624
07-01-2021