8048192: (bf) Out of direct buffer memory message should include the limits
Reviewed-by: alanb, rriggs
--- 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) {