From 6d8cd4f859c2320b33d4f27e811db468ef99f162 Mon Sep 17 00:00:00 2001 From: kamg Date: Fri, 27 Aug 2010 15:05:28 -0400 Subject: [PATCH] 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 --- src/share/vm/oops/instanceKlass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/vm/oops/instanceKlass.cpp b/src/share/vm/oops/instanceKlass.cpp index ff8077f1b..bfdf1d195 100644 --- a/src/share/vm/oops/instanceKlass.cpp +++ b/src/share/vm/oops/instanceKlass.cpp @@ -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); -- GitLab