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

[Linux] Memory leak when using indefinite transitions on Label

XMLWordPrintable

    • x86_64
    • linux

      FULL PRODUCT VERSION :
      openjdk version "1.8.0_91"
      OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3-b14)
      OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux 4.6.0-1-amd64 #1 SMP Debian 4.6.2-2 (2016-06-25) x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      When applying an animation with Animation.INDEFINITE as cycle count, the program quickly gobbles up all system memory.

      Tested on label with RotateTransition and TranslateTransition, but may be relevant to other animations or other node/control types.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a label.
      2. Create a RotateTransition or TranslateTransition with indefinite cycle count.
      3. Run the animation, and watch memory usage climb.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Memory usage should remain reasonable
      ACTUAL -
      Memory usage quickly climbs up to 4+ GB, and if left alone can turn entire system unresponsive.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package sample;

      import javafx.animation.Animation;
      import javafx.animation.RotateTransition;
      import javafx.animation.TranslateTransition;
      import javafx.application.Application;

      import javafx.scene.Node;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;
      import javafx.util.Duration;


      public class Demo extends Application {
          @Override
          public void start(Stage stage) throws Exception {
              Label l = new Label("A");
              StackPane sp = new StackPane(l);
              stage.setScene(new Scene(sp, 200, 200));
              stage.show();
              addTranslate(l);
              // addRotate(l); // uncomment to test with rotate

          }

          private void addRotate(Node target) {
              RotateTransition rt = new RotateTransition(Duration.millis(3000), target);
              rt.setToAngle(360);
              rt.setCycleCount(Animation.INDEFINITE);
              rt.play();
          }

          private void addTranslate(Node target) {
              TranslateTransition tt = new TranslateTransition(Duration.millis(3000), target);
              tt.setByX(50);
              tt.setAutoReverse(true);
              tt.setCycleCount(Animation.INDEFINITE);
              tt.play();
          }

          public static void main(String[] args) {
              launch(args);
          }

      }
      ---------- END SOURCE ----------

            ckyang Chien Yang (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: