提交 6d8cd4f8 编写于 作者: K kamg

6980262: Memory leak when exception is thrown in static initializer

Summary: Use resource memory instead of c-heap for the exception message
Reviewed-by: phh, jmasa
上级 98ec1205
......@@ -382,7 +382,7 @@ void instanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) {
const char* desc = "Could not initialize class ";
const char* className = this_oop->external_name();
size_t msglen = strlen(desc) + strlen(className) + 1;
char* message = NEW_C_HEAP_ARRAY(char, msglen);
char* message = NEW_RESOURCE_ARRAY(char, msglen);
if (NULL == message) {
// Out of memory: can't create detailed error message
THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), className);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册