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

javafx consumes all system memory - memory leak

XMLWordPrintable

    • x86_64
    • linux_ubuntu

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


      ADDITIONAL OS VERSION INFORMATION :
      Ubuntu Gnome 16.10

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      CPU: i5 Haswell with GPU: Intel HD 4000

      A DESCRIPTION OF THE PROBLEM :
      On the Intel HD 4000 graphics chip without VM parameters the javafx application runs until the computer runs out of memory. 100% reproducible on linux with this graphics chip. Bug doesn't happen on windows.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run this code from the zip
      https://drive.google.com/open?id=0BxzwX_i76rPESzhWQkR3aWJRVU0
      or build an example from the code included

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Memory stays at normal levels
      ACTUAL -
      VM consumes complete system memory in simple application

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No crash until OutOfMemory Error

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      timer = new AnimationTimer()
      {
      private long previousTime = 0;
      private float secondsElapsedSinceLastFpsUpdate = 0f;

      @Override
      public void handle(long currentTime)
      {
      if(previousTime == 0)
      {
      previousTime = currentTime;
      return;
      }

      float secondsElapsed = currentTime - previousTime;
      previousTime = currentTime;
      double delta = secondsElapsed / ((double)OPTIMAL_TIME);

      secondsElapsedSinceLastFpsUpdate += secondsElapsed;
      fps++;

      if(secondsElapsedSinceLastFpsUpdate >= 1000000000)
      {
      System.out.println("(FPS: " + fps + ")");
      secondsElapsedSinceLastFpsUpdate = 0;
      fps = 0;
      }

      //update ball location
      stack.setTranslateX(stack.getTranslateX() + direction.getX() * delta);
      stack.setTranslateY(stack.getTranslateY() + direction.getY() * delta);

      //hit detection
      HitLocation hitLocation = hitsWall(stack.getLayoutX(), stack.getLayoutY(), stack.getTranslateX(), stack.getTranslateY(), direction);
      //if ball collides with border then brick collisions are irrelevant
      if(hitLocation != null)
      {
      direction = reflectBall(hitLocation, direction);
      }
      //ball doesn't collide with border --> check collision with bricks
      else
      {
      hitLocation = collides(stack.getBoundsInParent(), stack.getLayoutX(), stack.getLayoutY(), stack.getTranslateX(), stack.getTranslateY(), rect, false);
      if(hitLocation != null)
      {
      direction = reflectBall(hitLocation, direction);
      }
      }

      try
      {
      Thread.sleep( (previousTime-System.nanoTime() + OPTIMAL_TIME)/1000000);
      }
      catch(Exception e)
      {
      e.printStackTrace();
      }
      }
      };

      timer.start();
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      include -Dprism.order=sw as parameter

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

              Created:
              Updated:
              Resolved: