-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
jfx17
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment Temurin-11.0.12+7 (build 11.0.12+7)
OpenJDK 64-Bit Server VM Temurin-11.0.12+7 (build 11.0.12+7, mixed mode)
Windows 10 Pro 64-bit
A DESCRIPTION OF THE PROBLEM :
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run attached sample.
2. Click on the button "change scene"
3. Take a heap dump and count the number of "MenuBarButton"
Although MenuBar has been removed from the scene, the reference to MenuBarButton is still in ControlAcceleratorSupport#sceneChangeListenerMap
---------- BEGIN SOURCE ----------
import com.sun.javafx.scene.control.ControlAcceleratorSupport;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class TestFx
{
public static void main( String[] args )
{
Application.launch( FxApp.class, args );
}
public static class FxApp extends Application
{
@Override
public void start( final Stage primaryStage ) throws Exception
{
System.err.println( System.getProperty( "javafx.version" ) );
MenuBar bar = createMenuBar( "Test1" );
MenuBar bar2 = createMenuBar( "Test2" );
MenuBar bar3 = createMenuBar( "Test3" );
MenuBar bar4 = createMenuBar( "Test4" );
Button button = new Button( "change scene" );
BorderPane pane = new BorderPane( button );
pane.getChildren()
.addAll( bar, bar2, bar3, bar4 );
button.setOnAction( ( ActionEvent event ) -> removeMenuBars( pane ) );
primaryStage.setScene( new Scene( pane, 800, 600 ) );
primaryStage.show();
}
private void removeMenuBars( BorderPane aBorderPane )
{
aBorderPane.getChildren()
.clear();
}
}
private static MenuBar createMenuBar( String aName )
{
MenuBar bar = new MenuBar();
Menu menu = new Menu( aName );
MenuItem item = new MenuItem( aName );
menu.getItems()
.add( item );
bar.getMenus()
.add( menu );
return bar;
}
}
---------- END SOURCE ----------
FREQUENCY : always
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment Temurin-11.0.12+7 (build 11.0.12+7)
OpenJDK 64-Bit Server VM Temurin-11.0.12+7 (build 11.0.12+7, mixed mode)
Windows 10 Pro 64-bit
A DESCRIPTION OF THE PROBLEM :
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run attached sample.
2. Click on the button "change scene"
3. Take a heap dump and count the number of "MenuBarButton"
Although MenuBar has been removed from the scene, the reference to MenuBarButton is still in ControlAcceleratorSupport#sceneChangeListenerMap
---------- BEGIN SOURCE ----------
import com.sun.javafx.scene.control.ControlAcceleratorSupport;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class TestFx
{
public static void main( String[] args )
{
Application.launch( FxApp.class, args );
}
public static class FxApp extends Application
{
@Override
public void start( final Stage primaryStage ) throws Exception
{
System.err.println( System.getProperty( "javafx.version" ) );
MenuBar bar = createMenuBar( "Test1" );
MenuBar bar2 = createMenuBar( "Test2" );
MenuBar bar3 = createMenuBar( "Test3" );
MenuBar bar4 = createMenuBar( "Test4" );
Button button = new Button( "change scene" );
BorderPane pane = new BorderPane( button );
pane.getChildren()
.addAll( bar, bar2, bar3, bar4 );
button.setOnAction( ( ActionEvent event ) -> removeMenuBars( pane ) );
primaryStage.setScene( new Scene( pane, 800, 600 ) );
primaryStage.show();
}
private void removeMenuBars( BorderPane aBorderPane )
{
aBorderPane.getChildren()
.clear();
}
}
private static MenuBar createMenuBar( String aName )
{
MenuBar bar = new MenuBar();
Menu menu = new Menu( aName );
MenuItem item = new MenuItem( aName );
menu.getItems()
.add( item );
bar.getMenus()
.add( menu );
return bar;
}
}
---------- END SOURCE ----------
FREQUENCY : always
- duplicates
-
JDK-8274022 Additional Memory Leak in ControlAcceleratorSupport
- Resolved
- relates to
-
JDK-8208088 Memory Leak in ControlAcceleratorSupport
- Resolved