equal
deleted
inserted
replaced
41 #include "runtime/init.hpp" |
41 #include "runtime/init.hpp" |
42 #include "runtime/java.hpp" |
42 #include "runtime/java.hpp" |
43 #include "runtime/mutex.hpp" |
43 #include "runtime/mutex.hpp" |
44 #include "runtime/orderAccess.hpp" |
44 #include "runtime/orderAccess.hpp" |
45 #include "services/memTracker.hpp" |
45 #include "services/memTracker.hpp" |
|
46 #include "services/memoryService.hpp" |
46 #include "utilities/copy.hpp" |
47 #include "utilities/copy.hpp" |
47 #include "utilities/debug.hpp" |
48 #include "utilities/debug.hpp" |
48 |
49 |
49 typedef BinaryTreeDictionary<Metablock, FreeList> BlockTreeDictionary; |
50 typedef BinaryTreeDictionary<Metablock, FreeList> BlockTreeDictionary; |
50 typedef BinaryTreeDictionary<Metachunk, FreeList> ChunkTreeDictionary; |
51 typedef BinaryTreeDictionary<Metachunk, FreeList> ChunkTreeDictionary; |
732 |
733 |
733 // Called when an allocation from the current chunk fails. |
734 // Called when an allocation from the current chunk fails. |
734 // Gets a new chunk (may require getting a new virtual space), |
735 // Gets a new chunk (may require getting a new virtual space), |
735 // and allocates from that chunk. |
736 // and allocates from that chunk. |
736 MetaWord* grow_and_allocate(size_t word_size); |
737 MetaWord* grow_and_allocate(size_t word_size); |
|
738 |
|
739 // Notify memory usage to MemoryService. |
|
740 void track_metaspace_memory_usage(); |
737 |
741 |
738 // debugging support. |
742 // debugging support. |
739 |
743 |
740 void dump(outputStream* const out) const; |
744 void dump(outputStream* const out) const; |
741 void print_on(outputStream* st) const; |
745 void print_on(outputStream* st) const; |
2058 Metachunk::overhead()); |
2062 Metachunk::overhead()); |
2059 } |
2063 } |
2060 return chunk_word_size; |
2064 return chunk_word_size; |
2061 } |
2065 } |
2062 |
2066 |
|
2067 void SpaceManager::track_metaspace_memory_usage() { |
|
2068 if (is_init_completed()) { |
|
2069 if (is_class()) { |
|
2070 MemoryService::track_compressed_class_memory_usage(); |
|
2071 } |
|
2072 MemoryService::track_metaspace_memory_usage(); |
|
2073 } |
|
2074 } |
|
2075 |
2063 MetaWord* SpaceManager::grow_and_allocate(size_t word_size) { |
2076 MetaWord* SpaceManager::grow_and_allocate(size_t word_size) { |
2064 assert(vs_list()->current_virtual_space() != NULL, |
2077 assert(vs_list()->current_virtual_space() != NULL, |
2065 "Should have been set"); |
2078 "Should have been set"); |
2066 assert(current_chunk() == NULL || |
2079 assert(current_chunk() == NULL || |
2067 current_chunk()->allocate(word_size) == NULL, |
2080 current_chunk()->allocate(word_size) == NULL, |
2096 if (next != NULL) { |
2109 if (next != NULL) { |
2097 // Add to this manager's list of chunks in use. |
2110 // Add to this manager's list of chunks in use. |
2098 add_chunk(next, false); |
2111 add_chunk(next, false); |
2099 mem = next->allocate(word_size); |
2112 mem = next->allocate(word_size); |
2100 } |
2113 } |
|
2114 |
|
2115 // Track metaspace memory usage statistic. |
|
2116 track_metaspace_memory_usage(); |
2101 |
2117 |
2102 return mem; |
2118 return mem; |
2103 } |
2119 } |
2104 |
2120 |
2105 void SpaceManager::print_on(outputStream* st) const { |
2121 void SpaceManager::print_on(outputStream* st) const { |