RFR: JDK-8230744 Several classes throw OutOfMemoryError without message
Roger Riggs
Roger.Riggs at oracle.com
Tue Jun 2 19:49:56 UTC 2020
Hi Jim,
Given the infrequency of the exception messages being used,
can we simplify them and/or reuse the strings?
The stack trace would usually show what API was being used so I would
simplfy the messages to:
"exceeds implementation limit" or "size exceeds implementation limit".
UnsyncByteArrayOutputStream: 49, 61, 73
UnsyncByteArrayOutputStream:247
AbstractStringBuilder:269
The message are not typically sentences so omit the final ".".
String.java: 3576, (I know it was there before),
Unsafe.java:632 "Not able to allocate" -> "Unable to allocate".
Isn't the "bytes of native memory" redundant with the function of
allocateMemory? (and can be omitted).
Ditto in reallocate, the allocate/reallocate is obvious from the stack
trace.
Thanks, Roger
On 6/2/20 9:52 AM, Jim Laskey wrote:
> Revised to reflect requested changes.
>
> http://cr.openjdk.java.net/~jlaskey/8230744/webrev-01/index.html <http://cr.openjdk.java.net/~jlaskey/8230744/webrev-01/index.html>
>
>
>> On Jun 1, 2020, at 5:40 PM, Martin Buchholz <martinrb at google.com> wrote:
>>
>> On Mon, Jun 1, 2020 at 1:37 PM Brent Christian
>> <brent.christian at oracle.com> wrote:
>>
>>> "Unable to allocate buffer" seems vague in the context of an OOME. If
>>> the problem is trying to create a too-large array, maybe something like,
>>> "Buffer for \\Q...\\E sequence would exceed maximum array size".
>> A generic message that does not necessarily expose the use of an
>> internal array seems best, e.g.
>>
>> "... exceeds implementation limits"
More information about the core-libs-dev
mailing list