8048192: (bf) Out of direct buffer memory message should include the limits
authorbpb
Fri, 22 Feb 2019 10:13:34 -0800
changeset 53902 7a6fd71449e7
parent 53901 0448cb38c418
child 53903 68bbd727dd5f
child 57208 7a45c67e73d0
8048192: (bf) Out of direct buffer memory message should include the limits Reviewed-by: alanb, rriggs
src/java.base/share/classes/java/nio/Bits.java
--- a/src/java.base/share/classes/java/nio/Bits.java	Fri Feb 22 10:13:33 2019 -0800
+++ b/src/java.base/share/classes/java/nio/Bits.java	Fri Feb 22 10:13:34 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -172,7 +172,10 @@
             }
 
             // no luck
-            throw new OutOfMemoryError("Direct buffer memory");
+            throw new OutOfMemoryError
+                ("Cannot reserve "
+                 + size + " bytes of direct buffer memory (allocated: "
+                 + RESERVED_MEMORY.get() + ", limit: " + MAX_MEMORY +")");
 
         } finally {
             if (interrupted) {