8036699: Add trace event when a metaspace allocation fails

Reviewed-by: jmasa, stefank
This commit is contained in:
Erik Helin 2014-03-18 07:00:06 +01:00
parent ddce6492be
commit b533eca89d
6 changed files with 73 additions and 0 deletions

View file

@ -3358,6 +3358,8 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
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.
@ -3426,6 +3428,16 @@ void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_s
}
}
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");