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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "memory/metaspace.hpp"
29 #include "oops/oop.inline.hpp"
30 #include "runtime/handles.inline.hpp"
31 #include "runtime/javaCalls.hpp"
32 #include "runtime/orderAccess.hpp"
33 #include "services/lowMemoryDetector.hpp"
34 #include "services/management.hpp"
35 #include "services/memoryManager.hpp"
36 #include "services/memoryPool.hpp"
37 #include "utilities/globalDefinitions.hpp"
38 #include "utilities/macros.hpp"
39
40 MemoryPool::MemoryPool(const char* name,
41 PoolType type,
42 size_t init_size,
43 size_t max_size,
44 bool support_usage_threshold,
45 bool support_gc_threshold) {
46 _name = name;
47 _initial_size = init_size;
194 MemoryPool("Metaspace", NonHeap, 0, calculate_max_size(), true, false) { }
195
196 MemoryUsage MetaspacePool::get_memory_usage() {
197 size_t committed = MetaspaceUtils::committed_bytes();
198 return MemoryUsage(initial_size(), used_in_bytes(), committed, max_size());
199 }
200
201 size_t MetaspacePool::used_in_bytes() {
202 return MetaspaceUtils::used_bytes();
203 }
204
205 size_t MetaspacePool::calculate_max_size() const {
206 return FLAG_IS_CMDLINE(MaxMetaspaceSize) ? MaxMetaspaceSize :
207 MemoryUsage::undefined_size();
208 }
209
210 CompressedKlassSpacePool::CompressedKlassSpacePool() :
211 MemoryPool("Compressed Class Space", NonHeap, 0, CompressedClassSpaceSize, true, false) { }
212
213 size_t CompressedKlassSpacePool::used_in_bytes() {
214 return MetaspaceUtils::used_bytes(Metaspace::ClassType);
215 }
216
217 MemoryUsage CompressedKlassSpacePool::get_memory_usage() {
218 size_t committed = MetaspaceUtils::committed_bytes(Metaspace::ClassType);
219 return MemoryUsage(initial_size(), used_in_bytes(), committed, max_size());
220 }
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "memory/metaspace/metaspaceEnums.hpp"
29 #include "memory/metaspace.hpp"
30 #include "oops/oop.inline.hpp"
31 #include "runtime/handles.inline.hpp"
32 #include "runtime/javaCalls.hpp"
33 #include "runtime/orderAccess.hpp"
34 #include "services/lowMemoryDetector.hpp"
35 #include "services/management.hpp"
36 #include "services/memoryManager.hpp"
37 #include "services/memoryPool.hpp"
38 #include "utilities/globalDefinitions.hpp"
39 #include "utilities/macros.hpp"
40
41 MemoryPool::MemoryPool(const char* name,
42 PoolType type,
43 size_t init_size,
44 size_t max_size,
45 bool support_usage_threshold,
46 bool support_gc_threshold) {
47 _name = name;
48 _initial_size = init_size;
195 MemoryPool("Metaspace", NonHeap, 0, calculate_max_size(), true, false) { }
196
197 MemoryUsage MetaspacePool::get_memory_usage() {
198 size_t committed = MetaspaceUtils::committed_bytes();
199 return MemoryUsage(initial_size(), used_in_bytes(), committed, max_size());
200 }
201
202 size_t MetaspacePool::used_in_bytes() {
203 return MetaspaceUtils::used_bytes();
204 }
205
206 size_t MetaspacePool::calculate_max_size() const {
207 return FLAG_IS_CMDLINE(MaxMetaspaceSize) ? MaxMetaspaceSize :
208 MemoryUsage::undefined_size();
209 }
210
211 CompressedKlassSpacePool::CompressedKlassSpacePool() :
212 MemoryPool("Compressed Class Space", NonHeap, 0, CompressedClassSpaceSize, true, false) { }
213
214 size_t CompressedKlassSpacePool::used_in_bytes() {
215 return MetaspaceUtils::used_bytes(metaspace::ClassType);
216 }
217
218 MemoryUsage CompressedKlassSpacePool::get_memory_usage() {
219 size_t committed = MetaspaceUtils::committed_bytes(metaspace::ClassType);
220 return MemoryUsage(initial_size(), used_in_bytes(), committed, max_size());
221 }
|