# HG changeset patch # User kamg # Date 1282935928 14400 # Node ID 2528b5bd749c8e1d002c4255c63c0af67e1c7514 # Parent c7004d700b492843c4ef66cbf44901e580041b3e 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 diff -r c7004d700b49 -r 2528b5bd749c src/share/vm/oops/instanceKlass.cpp --- a/src/share/vm/oops/instanceKlass.cpp Wed Aug 25 21:29:05 2010 -0400 +++ b/src/share/vm/oops/instanceKlass.cpp Fri Aug 27 15:05:28 2010 -0400 @@ -382,7 +382,7 @@ 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);