/* * Copyright (c) 2003, 2020, 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. *
*/
// A memory manager is responsible for managing one or more memory pools. // The garbage collector is one type of memory managers responsible // for reclaiming memory occupied by unreachable objects. A Java virtual // machine may have one or more memory managers. It may // add or remove memory managers during execution. // A memory pool can be managed by more than one memory managers.
class MemoryPool; class GCMemoryManager; class OopClosure;
class MemoryManager : public CHeapObj<mtInternal> { protected: enum {
max_num_pools = 10
};
private:
MemoryPool* _pools[max_num_pools]; int _num_pools;
// Static factory methods to get a memory manager of a specific type static MemoryManager* get_code_cache_memory_manager(); static MemoryManager* get_metaspace_memory_manager();
};
class GCStatInfo : public CHeapObj<mtGC> { private:
size_t _index;
jlong _start_time;
jlong _end_time;
// We keep memory usage of all memory pools
MemoryUsage* _before_gc_usage_array;
MemoryUsage* _after_gc_usage_array; int _usage_array_size;
class GCMemoryManager : public MemoryManager { private: // TODO: We should unify the GCCounter and GCMemoryManager statistic
size_t _num_collections;
elapsedTimer _accumulated_timer;
GCStatInfo* _last_gc_stat;
Mutex* _last_gc_lock;
GCStatInfo* _current_gc_stat; int _num_gc_threads; volatilebool _notification_enabled; constchar* _gc_end_message; bool _pool_always_affected_by_gc[MemoryManager::max_num_pools];
// Copy out _last_gc_stat to the given destination, returning // the collection count. Zero signifies no gc has taken place.
size_t get_last_gc_stat(GCStatInfo* dest);
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.