Mon, 07 Oct 2013 15:51:17 +0200
8025996: Track metaspace usage when metaspace is expanded
Reviewed-by: coleenp, ehelin
src/share/vm/memory/metaspace.cpp | file | annotate | diff | comparison | revisions | |
src/share/vm/services/memoryService.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/memory/metaspace.cpp Mon Oct 07 15:51:08 2013 +0200 1.2 +++ b/src/share/vm/memory/metaspace.cpp Mon Oct 07 15:51:17 2013 +0200 1.3 @@ -43,6 +43,7 @@ 1.4 #include "runtime/mutex.hpp" 1.5 #include "runtime/orderAccess.hpp" 1.6 #include "services/memTracker.hpp" 1.7 +#include "services/memoryService.hpp" 1.8 #include "utilities/copy.hpp" 1.9 #include "utilities/debug.hpp" 1.10 1.11 @@ -735,6 +736,9 @@ 1.12 // and allocates from that chunk. 1.13 MetaWord* grow_and_allocate(size_t word_size); 1.14 1.15 + // Notify memory usage to MemoryService. 1.16 + void track_metaspace_memory_usage(); 1.17 + 1.18 // debugging support. 1.19 1.20 void dump(outputStream* const out) const; 1.21 @@ -2060,6 +2064,15 @@ 1.22 return chunk_word_size; 1.23 } 1.24 1.25 +void SpaceManager::track_metaspace_memory_usage() { 1.26 + if (is_init_completed()) { 1.27 + if (is_class()) { 1.28 + MemoryService::track_compressed_class_memory_usage(); 1.29 + } 1.30 + MemoryService::track_metaspace_memory_usage(); 1.31 + } 1.32 +} 1.33 + 1.34 MetaWord* SpaceManager::grow_and_allocate(size_t word_size) { 1.35 assert(vs_list()->current_virtual_space() != NULL, 1.36 "Should have been set"); 1.37 @@ -2099,6 +2112,9 @@ 1.38 mem = next->allocate(word_size); 1.39 } 1.40 1.41 + // Track metaspace memory usage statistic. 1.42 + track_metaspace_memory_usage(); 1.43 + 1.44 return mem; 1.45 } 1.46
2.1 --- a/src/share/vm/services/memoryService.hpp Mon Oct 07 15:51:08 2013 +0200 2.2 +++ b/src/share/vm/services/memoryService.hpp Mon Oct 07 15:51:17 2013 +0200 2.3 @@ -148,6 +148,12 @@ 2.4 static void track_code_cache_memory_usage() { 2.5 track_memory_pool_usage(_code_heap_pool); 2.6 } 2.7 + static void track_metaspace_memory_usage() { 2.8 + track_memory_pool_usage(_metaspace_pool); 2.9 + } 2.10 + static void track_compressed_class_memory_usage() { 2.11 + track_memory_pool_usage(_compressed_class_pool); 2.12 + } 2.13 static void track_memory_pool_usage(MemoryPool* pool); 2.14 2.15 static void gc_begin(bool fullGC, bool recordGCBeginTime,