comparison src/share/vm/memory/metaspace.cpp @ 17769:bc7714614ad8

8036699: Add trace event when a metaspace allocation fails Reviewed-by: jmasa, stefank
author ehelin
date Fri, 21 Mar 2014 10:20:00 +0100
parents daef39043d2c
children 5af31f70a866
comparison
equal deleted inserted replaced
17768:daef39043d2c 17769:bc7714614ad8
3355 3355
3356 // Try to allocate metadata. 3356 // Try to allocate metadata.
3357 MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype); 3357 MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype);
3358 3358
3359 if (result == NULL) { 3359 if (result == NULL) {
3360 tracer()->report_metaspace_allocation_failure(loader_data, word_size, type, mdtype);
3361
3360 // Allocation failed. 3362 // Allocation failed.
3361 if (is_init_completed()) { 3363 if (is_init_completed()) {
3362 // Only start a GC if the bootstrapping has completed. 3364 // Only start a GC if the bootstrapping has completed.
3363 3365
3364 // Try to clean out some memory and retry. 3366 // Try to clean out some memory and retry.
3420 3422
3421 if (out_of_compressed_class_space) { 3423 if (out_of_compressed_class_space) {
3422 THROW_OOP(Universe::out_of_memory_error_class_metaspace()); 3424 THROW_OOP(Universe::out_of_memory_error_class_metaspace());
3423 } else { 3425 } else {
3424 THROW_OOP(Universe::out_of_memory_error_metaspace()); 3426 THROW_OOP(Universe::out_of_memory_error_metaspace());
3427 }
3428 }
3429
3430 const char* Metaspace::metadata_type_name(Metaspace::MetadataType mdtype) {
3431 switch (mdtype) {
3432 case Metaspace::ClassType: return "Class";
3433 case Metaspace::NonClassType: return "Metadata";
3434 default:
3435 assert(false, err_msg("Got bad mdtype: %d", (int) mdtype));
3436 return NULL;
3425 } 3437 }
3426 } 3438 }
3427 3439
3428 void Metaspace::record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size) { 3440 void Metaspace::record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size) {
3429 assert(DumpSharedSpaces, "sanity"); 3441 assert(DumpSharedSpaces, "sanity");