src/share/vm/memory/metaspace.cpp
Print this page
rev 6083 : 8036699: Add trace event when a metaspace allocation fails
@@ -3356,10 +3356,12 @@
// Try to allocate metadata.
MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype);
if (result == NULL) {
+ tracer()->report_metaspace_allocation_failure(loader_data, word_size, type, mdtype);
+
// Allocation failed.
if (is_init_completed()) {
// Only start a GC if the bootstrapping has completed.
// Try to clean out some memory and retry.
@@ -3424,10 +3426,20 @@
} else {
THROW_OOP(Universe::out_of_memory_error_metaspace());
}
}
+const char* Metaspace::metadata_type_name(Metaspace::MetadataType mdtype) {
+ switch (mdtype) {
+ case Metaspace::ClassType: return "Class Type";
+ case Metaspace::NonClassType: return "Non Class Type";
+ default:
+ assert(false, err_msg("Got bad mdtype: %d", (int) mdtype));
+ return NULL;
+ }
+}
+
void Metaspace::record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size) {
assert(DumpSharedSpaces, "sanity");
AllocRecord *rec = new AllocRecord((address)ptr, type, (int)word_size * HeapWordSize);
if (_alloc_record_head == NULL) {