changeset 55112:7a6fd71449e7

8048192: (bf) Out of direct buffer memory message should include the limits Reviewed-by: alanb, rriggs
author bpb
date Fri, 22 Feb 2019 10:13:34 -0800
parents 0448cb38c418
children 68bbd727dd5f
files src/java.base/share/classes/java/nio/Bits.java
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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) {