ADDITIONAL SYSTEM INFORMATION :
Microsoft Windows [Version 10.0.18363.1198]
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.5+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.5+10, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Creating ScrollPane with same content component causes memory leak until the component is removed from the scene.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Open provided ScrollPaneLeakTest.
2. Keep pressing the "test' button.
3. Invoke GC and observe the ScrollPane count in memory analyzing tools - jvisualvm or Eclipse MAT.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
After 3. the ScrollPane count should be 1.
ACTUAL -
Aftery 3. every time the button is pressed, the ScrollPane is created, it is present in heap dump.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class ScrollPaneLeakTest
{
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" ) );
final var testLabel = new Label( "Test label" );
final var rootPane = new BorderPane();
final var testButton = new Button( "test" );
testButton.setOnAction( e -> {
rootPane.setCenter( new ScrollPane( testLabel ) );
} );
rootPane.setTop( testButton );
rootPane.setCenter( new ScrollPane( testLabel ) );
primaryStage.setScene( new Scene( rootPane, 800, 600 ) );
primaryStage.show();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
no workaround
FREQUENCY : always
Microsoft Windows [Version 10.0.18363.1198]
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.5+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.5+10, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Creating ScrollPane with same content component causes memory leak until the component is removed from the scene.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Open provided ScrollPaneLeakTest.
2. Keep pressing the "test' button.
3. Invoke GC and observe the ScrollPane count in memory analyzing tools - jvisualvm or Eclipse MAT.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
After 3. the ScrollPane count should be 1.
ACTUAL -
Aftery 3. every time the button is pressed, the ScrollPane is created, it is present in heap dump.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class ScrollPaneLeakTest
{
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" ) );
final var testLabel = new Label( "Test label" );
final var rootPane = new BorderPane();
final var testButton = new Button( "test" );
testButton.setOnAction( e -> {
rootPane.setCenter( new ScrollPane( testLabel ) );
} );
rootPane.setTop( testButton );
rootPane.setCenter( new ScrollPane( testLabel ) );
primaryStage.setScene( new Scene( rootPane, 800, 600 ) );
primaryStage.show();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
no workaround
FREQUENCY : always
- relates to
-
JDK-8293606 Labeled: memory leak when moving the graphic to another parent
- Open