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

(bf) java/nio/Buffer/LimitDirectMemory.java fails with OutOfMemoryError

XMLWordPrintable

      Test: java/nio/Buffer/LimitDirectMemory.java

      Exception in thread "main" java.lang.OutOfMemoryError: Cannot reserve 8192 bytes of direct buffer memory (allocated: 0, limit: 10)
      at java.base/java.nio.Bits.reserveMemory(Bits.java:178)
      at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:105)
      at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:363)
      at java.base/sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:242)
      at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:304)
      at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:284)
      at java.base/sun.nio.ch.FileChannelImpl.implRead(FileChannelImpl.java:251)
      at java.base/sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:231)
      at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:74)
      at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
      at java.base/java.io.InputStream.read(InputStream.java:220)
      at java.base/java.util.Properties$LineReader.readLine(Properties.java:505)
      at java.base/java.util.Properties.load0(Properties.java:421)
      at java.base/java.util.Properties.load(Properties.java:410)

      This test deliberately sets -XX:MaxDirectMemorySize=10 and this failure shows that the core libs code is now requiring at least 8K of direct memory buffers where previously it did not.

            bpb Brian Burkhalter
            bpb Brian Burkhalter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: