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

ProgressIndicator has memory leak

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 7u9
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:
    • Environment:

      Windows XP, 7

      Description

      ProgressIndicatorTest has memory leak has memory leak when it is used in separate Stage.
      /*
       * Created on Oct 18, 2012
       */
      package mytests;

      import javafx.application.*;
      import javafx.event.*;
      import javafx.scene.*;
      import javafx.scene.control.*;
      import javafx.scene.layout.*;
      import javafx.scene.paint.*;
      import javafx.stage.*;
      /**
       * @author mifeld
       */
      public class ProgressIndicatorTest extends Application
      {
      @Override
      public void start(final Stage stage) throws Exception
      {
      Button butt = new Button("Show dialog");
      butt.setOnAction(new EventHandler<ActionEvent>()
      {
      @Override
      public void handle(ActionEvent arg0)
      {
      showDialog(stage);
      }
      });
      Scene scene = new Scene(butt, 300, 250);

        stage.setScene(scene);
        stage.show();
      }
      public static void main(String[] args)
      {
      Application.launch(args);
      }
      private static void initStage(Stage stage)
      {
      stage.centerOnScreen();


      stage.initModality(Modality.APPLICATION_MODAL);
      }
      private static void showDialog(Stage stage)
      {
      Stage dialog = createDialog();
      initStage(dialog);
      dialog.show();
      }
      private static Stage createDialog()
      {
      final ProgressIndicator pi = new ProgressIndicator();
      Button button = new Button();
      button.setText("Cancel");

      VBox vbox = new VBox(20);
      vbox.getChildren().setAll(pi,button);

      Scene scene = new Scene(vbox);
      scene.setFill(Color.LIGHTGRAY);

      final Stage res = new Stage(StageStyle.UTILITY);
      res.setScene(scene);


      button.setOnAction(new EventHandler<ActionEvent>()
      {
      @Override
      public void handle(ActionEvent avt)
      {
      res.close();
      }
      });
      return res;
      }

      }

      You can see that after Stage.close() the instance of ProgressIndicator will never garbage collected

        Attachments

          Activity

            People

            • Assignee:
              dgrieve David Grieve (Inactive)
              Reporter:
              mfeldmanjfx Michael Feldman (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: