RFR: 8278125: Some preallocated OOMEs are missing stack trace [v3]

Coleen Phillimore coleenp at openjdk.java.net
Mon Dec 20 23:19:54 UTC 2021


On Mon, 20 Dec 2021 23:14:05 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> OopHandle Universe::_metaspace_string;
>> ...
>> msg = String::intern("Metaspace", CHECK);
>> java_lang_Throwable::set_message(oom_array->obj_at(_oom_metaspace, msg());
>> Universe::_metaspace_string = OopHandle(vm_global(), msg);
>> ...
>> bool Universe::is_metaspace_oome(oop exc) {
>>   return java_lang_Throwable::get_message(exc) == _metaspace_string.resolve();
>> }
>
> Maybe not.  Maybe the exception you're checking could be newly allocated and not use an interned string.

This code could also increment the counter and it might be much cleaner.
  if (out_of_compressed_class_space) {
    THROW_OOP(Universe::out_of_memory_error_class_metaspace());
  } else {
    THROW_OOP(Universe::out_of_memory_error_metaspace());
  }

-------------

PR: https://git.openjdk.java.net/jdk/pull/6672


More information about the hotspot-runtime-dev mailing list