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

Out of memory while inserting and removing contents into the scene

XMLWordPrintable

      Partner reported issue :

      Out of memory while inserting and removing contents into the scene.

      Reproducible case :

      Here is a sample program I wrote to reproduce the issue...


      package timosoutofmemoryissue;

      import javafx.stage.Stage;
      import javafx.scene.Scene;
      import javafx.scene.text.Text;
      import javafx.scene.text.Font;
      import javafx.scene.shape.Rectangle;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Circle;

      /**
       * @author Guru Sakaleshpura
       */
      public function testmemlimit() {

      var seq ;
              for (m in [0..500]) {
                 for (i in [0..500]) {
                       insert Rectangle {
                              x: i, y: 10
                              width: 20, height: 20
                              fill: Color.RED
                       }
                       into stage.scene.content;
                 }

                 println("sizeof stage.scene.content: {sizeof stage.scene.content}");
                 seq = Main.stage.scene.content[node | not (node instanceof Rectangle)];
                 stage.scene.content = seq;
                 println("sizeof stage.scene.content: {sizeof stage.scene.content}");
              }
      }


      var scene:Scene = Scene {
              content :[]
      }

      var stage:Stage = Stage {
          scene: scene
          width: 320
          height: 240
      }

      function run() {
          testmemlimit();
          stage;
      }

      //----------------------------------------------------------------------------------

        1. CssBug.fx
          0.9 kB
          Jonathan Giles

            kcr Kevin Rushforth
            gsakaleshpur Guru Sakaleshpura (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: