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

MediaPlayer Leaking Native Memory

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      java version "1.8.0_151"
      Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      When I use the java fx Media Player to play a big mp4 file the native memory explodes to more then 10 gigabytes in a matter of minutes. The heap size however remains the same.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the following program with a mp4 file with
      Frame width: 1920
      Frame height: 1080
      Data rate: 50008kbps
      Total bite rate: 5144kbp
      Frame rate: 50fps





      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      In a matter of minutes the system will freeze because all RAM is being used.
      ACTUAL -
      Windows freezes and start paging.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.media.Media;
      import javafx.scene.media.MediaPlayer;
      import javafx.scene.media.MediaView;
      import javafx.stage.Stage;

      import java.io.File;

      import static javafx.application.Application.launch;

      public class Main extends Application {

        @Override
        public void start(Stage primaryStage)
        {
          //Add a scene
          Group root = new Group();
          Scene scene = new Scene( root, 500, 200);

          File file = new File( "H:\\PRIVATE\\M4ROOT\\CLIP\\C0001.MP4" );

          Media pick = new Media( file.toURI().toString());
          MediaPlayer player = new MediaPlayer( pick);
          player.play();

          //Add a mediaView, to display the media. Its necessary !
          //This mediaView is added to a Pane
          MediaView mediaView = new MediaView( player);
          ((Group )scene.getRoot()).getChildren().add( mediaView);


          primaryStage.setTitle("Media Player");
          primaryStage.setScene(scene);
          primaryStage.show();
        }
        public static void main(String[] args) {
          launch(args);
        }
      }

      ---------- END SOURCE ----------

            almatvee Alexander Matveev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: