diff 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
line wrap: on
line diff
--- a/src/share/vm/memory/metaspace.cpp	Fri Mar 21 10:17:47 2014 +0100
+++ b/src/share/vm/memory/metaspace.cpp	Fri Mar 21 10:20:00 2014 +0100
@@ -3357,6 +3357,8 @@
   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.
@@ -3425,6 +3427,16 @@
   }
 }
 
+const char* Metaspace::metadata_type_name(Metaspace::MetadataType mdtype) {
+  switch (mdtype) {
+    case Metaspace::ClassType: return "Class";
+    case Metaspace::NonClassType: return "Metadata";
+    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");