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

Problem with OutOfMemoryError and JDK-9

    Details

    • Subcomponent:
      gc
    • Introduced In Build:
      b99
    • Introduced In Version:
      9
    • CPU:
      x86_64
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      java-8-oracle and java-9-oracle

      ADDITIONAL OS VERSION INFORMATION :
      Ubuntu 16.04 64x

      A DESCRIPTION OF THE PROBLEM :
      The code I add below is working normally with java-8-oracle and complete catch and finally block but with java-9-oracle it prints
      //Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
      which i think my be a problem if we close some resources in finally block.
      I try to reproduce also StackOverflow but there is all good with no difference.
      So can you just give me a feedback if this is a new feature or something like that.



      REGRESSION. Last worked in version 8u144

      ADDITIONAL REGRESSION INFORMATION:
      I am currently with java-9-oracle but I have also 1.8.144


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      import java.util.ArrayList;
      import java.util.List;

      public class Test {

          public static void main(String[] args) {

              List<Integer> list = new ArrayList<>();

              try{
                  for (int i = 0; i < Integer.MAX_VALUE; i++){
                      list.add(i);
                  }
              } catch (Throwable e){
                  System.out.println("Test catch");
              } finally {
                  System.out.println("Test finally");
              }
          }
      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      To print the same think as with JDk-8 - complete the catch and finally block
      ACTUAL -
      Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.ArrayList;
      import java.util.List;

      public class Test {

          public static void main(String[] args) {

              List<Integer> list = new ArrayList<>();

              try{
                  for (int i = 0; i < Integer.MAX_VALUE; i++){
                      list.add(i);
                  }
              } catch (Throwable e){
                  System.out.println("Test catch");
              } finally {
                  System.out.println("Test finally");
              }
          }
      }
      ---------- END SOURCE ----------

        Attachments

        1. Test.java
          0.5 kB
          Fairoz Matte

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: