/* * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
void MemoryService::add_code_heap_memory_pool(CodeHeap* heap, constchar* name) { // Create new memory pool for this heap
MemoryPool* code_heap_pool = new CodeHeapPool(heap, name, true/* support_usage_threshold */);
// Append to lists
_code_heap_pools->append(code_heap_pool);
_pools_list->append(code_heap_pool);
_metaspace_pool = new MetaspacePool();
mgr->add_pool(_metaspace_pool);
_pools_list->append(_metaspace_pool);
if (UseCompressedClassPointers) {
_compressed_class_pool = new CompressedKlassSpacePool();
mgr->add_pool(_compressed_class_pool);
_pools_list->append(_compressed_class_pool);
}
_managers_list->append(mgr);
}
MemoryManager* MemoryService::get_memory_manager(instanceHandle mh) { for (int i = 0; i < _managers_list->length(); i++) {
MemoryManager* mgr = _managers_list->at(i); if (mgr->is_manager(mh)) { return mgr;
}
} return NULL;
}
MemoryPool* MemoryService::get_memory_pool(instanceHandle ph) { for (int i = 0; i < _pools_list->length(); i++) {
MemoryPool* pool = _pools_list->at(i); if (pool->is_pool(ph)) { return pool;
}
} return NULL;
}
void MemoryService::track_memory_usage() { // Track the peak memory usage for (int i = 0; i < _pools_list->length(); i++) {
MemoryPool* pool = _pools_list->at(i);
pool->record_peak_memory_usage();
}
// Track the peak memory usage when GC begins if (recordPeakUsage) { for (int i = 0; i < _pools_list->length(); i++) {
MemoryPool* pool = _pools_list->at(i);
pool->record_peak_memory_usage();
}
}
}
bool MemoryService::set_verbose(bool verbose) {
MutexLocker m(Management_lock); // verbose will be set to the previous value if (verbose) {
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc));
} else {
LogConfiguration::configure_stdout(LogLevel::Off, true, LOG_TAGS(gc));
}
ClassLoadingService::reset_trace_class_unloading();
return verbose;
}
Handle MemoryService::create_MemoryUsage_obj(MemoryUsage usage, TRAPS) {
InstanceKlass* ik = Management::java_lang_management_MemoryUsage_klass(CHECK_NH);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.