Mercurial > hg > graal-compiler
changeset 17770:5af31f70a866
8036701: Add trace event when a metaspace throws out of memory error
Reviewed-by: stefank, mgerdin
author | ehelin |
---|---|
date | Fri, 21 Mar 2014 10:28:07 +0100 |
parents | bc7714614ad8 |
children | 9fdaa79b0c27 |
files | src/share/vm/memory/metaspace.cpp src/share/vm/memory/metaspace.hpp src/share/vm/memory/metaspaceTracer.cpp src/share/vm/memory/metaspaceTracer.hpp src/share/vm/trace/trace.xml |
diffstat | 5 files changed, 39 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/memory/metaspace.cpp Fri Mar 21 10:20:00 2014 +0100 +++ b/src/share/vm/memory/metaspace.cpp Fri Mar 21 10:28:07 2014 +0100 @@ -3370,7 +3370,7 @@ } if (result == NULL) { - report_metadata_oome(loader_data, word_size, mdtype, CHECK_NULL); + report_metadata_oome(loader_data, word_size, type, mdtype, CHECK_NULL); } // Zero initialize. @@ -3384,7 +3384,9 @@ return class_vsm()->calc_chunk_size(word_size); } -void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, MetadataType mdtype, TRAPS) { +void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, MetaspaceObj::Type type, MetadataType mdtype, TRAPS) { + tracer()->report_metadata_oom(loader_data, word_size, type, mdtype); + // If result is still null, we are out of memory. if (Verbose && TraceMetadataChunkAllocation) { gclog_or_tty->print_cr("Metaspace allocation failed for size "
--- a/src/share/vm/memory/metaspace.hpp Fri Mar 21 10:20:00 2014 +0100 +++ b/src/share/vm/memory/metaspace.hpp Fri Mar 21 10:28:07 2014 +0100 @@ -238,7 +238,7 @@ static void purge(); static void report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, - MetadataType mdtype, TRAPS); + MetaspaceObj::Type type, MetadataType mdtype, TRAPS); static const char* metadata_type_name(Metaspace::MetadataType mdtype);
--- a/src/share/vm/memory/metaspaceTracer.cpp Fri Mar 21 10:20:00 2014 +0100 +++ b/src/share/vm/memory/metaspaceTracer.cpp Fri Mar 21 10:28:07 2014 +0100 @@ -44,7 +44,22 @@ size_t word_size, MetaspaceObj::Type objtype, Metaspace::MetadataType mdtype) const { - EventMetaspaceAllocationFailure event; + send_allocation_failure_event<EventMetaspaceAllocationFailure>(cld, word_size, objtype, mdtype); +} + +void MetaspaceTracer::report_metadata_oom(ClassLoaderData *cld, + size_t word_size, + MetaspaceObj::Type objtype, + Metaspace::MetadataType mdtype) const { + send_allocation_failure_event<EventMetaspaceOOM>(cld, word_size, objtype, mdtype); +} + +template <typename E> +void MetaspaceTracer::send_allocation_failure_event(ClassLoaderData *cld, + size_t word_size, + MetaspaceObj::Type objtype, + Metaspace::MetadataType mdtype) const { + E event; if (event.should_commit()) { if (cld->is_anonymous()) { event.set_classLoader(NULL);
--- a/src/share/vm/memory/metaspaceTracer.hpp Fri Mar 21 10:20:00 2014 +0100 +++ b/src/share/vm/memory/metaspaceTracer.hpp Fri Mar 21 10:28:07 2014 +0100 @@ -32,6 +32,11 @@ class ClassLoaderData; class MetaspaceTracer : public CHeapObj<mtTracing> { + template <typename E> + void send_allocation_failure_event(ClassLoaderData *cld, + size_t word_size, + MetaspaceObj::Type objtype, + Metaspace::MetadataType mdtype) const; public: void report_gc_threshold(size_t old_val, size_t new_val, @@ -40,6 +45,11 @@ size_t word_size, MetaspaceObj::Type objtype, Metaspace::MetadataType mdtype) const; + void report_metadata_oom(ClassLoaderData *cld, + size_t word_size, + MetaspaceObj::Type objtype, + Metaspace::MetadataType mdtype) const; + }; #endif // SHARE_VM_MEMORY_METASPACE_TRACER_HPP
--- a/src/share/vm/trace/trace.xml Fri Mar 21 10:20:00 2014 +0100 +++ b/src/share/vm/trace/trace.xml Fri Mar 21 10:28:07 2014 +0100 @@ -213,6 +213,14 @@ <value type="METASPACEOBJTYPE" field="metaspaceObjectType" label="Metaspace Object Type" /> </event> + <event id="MetaspaceOOM" path="vm/gc/metaspace/out_of_memory" label="Metaspace Out of Memory" is_instant="true" has_stacktrace="true"> + <value type="CLASS" field="classLoader" label="Class Loader" /> + <value type="BOOLEAN" field="anonymousClassLoader" label="Anonymous Class Loader" /> + <value type="BYTES64" field="size" label="Size" /> + <value type="METADATATYPE" field="metadataType" label="Metadata Type" /> + <value type="METASPACEOBJTYPE" field="metaspaceObjectType" label="Metaspace Object Type" /> + </event> + <event id="PSHeapSummary" path="vm/gc/heap/ps_summary" label="Parallel Scavenge Heap Summary" is_instant="true"> <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/> <value type="GCWHEN" field="when" label="When" />