1 /*
2 * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
54 private:
55 enum {
56 init_pools_list_size = 10,
57 init_managers_list_size = 5,
58 init_code_heap_pools_size = 9
59 };
60
61 static GrowableArray<MemoryPool*>* _pools_list;
62 static GrowableArray<MemoryManager*>* _managers_list;
63
64 // memory managers for minor and major GC statistics
65 static GCMemoryManager* _major_gc_manager;
66 static GCMemoryManager* _minor_gc_manager;
67
68 // memory manager and code heap pools for the CodeCache
69 static MemoryManager* _code_cache_manager;
70 static GrowableArray<MemoryPool*>* _code_heap_pools;
71
72 static MemoryPool* _metaspace_pool;
73 static MemoryPool* _compressed_class_pool;
74
75 static void add_generation_memory_pool(Generation* gen,
76 MemoryManager* major_mgr,
77 MemoryManager* minor_mgr);
78 static void add_generation_memory_pool(Generation* gen,
79 MemoryManager* major_mgr) {
80 add_generation_memory_pool(gen, major_mgr, NULL);
81 }
82
83
84 static void add_psYoung_memory_pool(PSYoungGen* young_gen,
85 MemoryManager* major_mgr,
86 MemoryManager* minor_mgr);
87 static void add_psOld_memory_pool(PSOldGen* old_gen,
88 MemoryManager* mgr);
89
90 static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h,
91 MemoryManager* major_mgr,
92 MemoryManager* minor_mgr);
93 static void add_g1OldGen_memory_pool(G1CollectedHeap* g1h,
94 MemoryManager* mgr);
95
96 static MemoryPool* add_space(ContiguousSpace* space,
97 const char* name,
98 bool is_heap,
99 size_t max_size,
100 bool support_usage_threshold);
101 static MemoryPool* add_survivor_spaces(DefNewGeneration* young_gen,
102 const char* name,
103 bool is_heap,
104 size_t max_size,
105 bool support_usage_threshold);
106 static MemoryPool* add_gen(Generation* gen,
107 const char* name,
108 bool is_heap,
109 bool support_usage_threshold);
110 static MemoryPool* add_cms_space(CompactibleFreeListSpace* space,
111 const char* name,
112 bool is_heap,
113 size_t max_size,
114 bool support_usage_threshold);
115
116 static void add_gen_collected_heap_info(GenCollectedHeap* heap);
117 static void add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap);
118 static void add_g1_heap_info(G1CollectedHeap* g1h);
119
120 public:
121 static void set_universe_heap(CollectedHeap* heap);
122 static void add_code_heap_memory_pool(CodeHeap* heap, const char* name);
123 static void add_metaspace_memory_pools();
124
125 static MemoryPool* get_memory_pool(instanceHandle pool);
126 static MemoryManager* get_memory_manager(instanceHandle mgr);
127
128 static const int num_memory_pools() {
129 return _pools_list->length();
130 }
131 static const int num_memory_managers() {
132 return _managers_list->length();
133 }
134
135 static MemoryPool* get_memory_pool(int index) {
136 return _pools_list->at(index);
137 }
138
|
1 /*
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
54 private:
55 enum {
56 init_pools_list_size = 10,
57 init_managers_list_size = 5,
58 init_code_heap_pools_size = 9
59 };
60
61 static GrowableArray<MemoryPool*>* _pools_list;
62 static GrowableArray<MemoryManager*>* _managers_list;
63
64 // memory managers for minor and major GC statistics
65 static GCMemoryManager* _major_gc_manager;
66 static GCMemoryManager* _minor_gc_manager;
67
68 // memory manager and code heap pools for the CodeCache
69 static MemoryManager* _code_cache_manager;
70 static GrowableArray<MemoryPool*>* _code_heap_pools;
71
72 static MemoryPool* _metaspace_pool;
73 static MemoryPool* _compressed_class_pool;
74
75 public:
76 static void set_universe_heap(CollectedHeap* heap);
77 static void add_code_heap_memory_pool(CodeHeap* heap, const char* name);
78 static void add_metaspace_memory_pools();
79
80 static MemoryPool* get_memory_pool(instanceHandle pool);
81 static MemoryManager* get_memory_manager(instanceHandle mgr);
82
83 static const int num_memory_pools() {
84 return _pools_list->length();
85 }
86 static const int num_memory_managers() {
87 return _managers_list->length();
88 }
89
90 static MemoryPool* get_memory_pool(int index) {
91 return _pools_list->at(index);
92 }
93
|