mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8195115: G1 Old Gen MemoryPool CollectionUsage.used values don't reflect mixed GC results
Memory pools can now be optional collection participants, e.g., G1 Old Gen in an incremental collection. Reviewed-by: ehelin, mchung
This commit is contained in:
parent
425e1a8bb8
commit
ebe240f3f4
8 changed files with 280 additions and 20 deletions
|
@ -43,13 +43,15 @@ MemoryManager::MemoryManager(const char* name) : _name(name) {
|
|||
(void)const_cast<instanceOop&>(_memory_mgr_obj = instanceOop(NULL));
|
||||
}
|
||||
|
||||
void MemoryManager::add_pool(MemoryPool* pool) {
|
||||
assert(_num_pools < MemoryManager::max_num_pools, "_num_pools exceeds the max");
|
||||
if (_num_pools < MemoryManager::max_num_pools) {
|
||||
_pools[_num_pools] = pool;
|
||||
int MemoryManager::add_pool(MemoryPool* pool) {
|
||||
int index = _num_pools;
|
||||
assert(index < MemoryManager::max_num_pools, "_num_pools exceeds the max");
|
||||
if (index < MemoryManager::max_num_pools) {
|
||||
_pools[index] = pool;
|
||||
_num_pools++;
|
||||
}
|
||||
pool->add_manager(this);
|
||||
return index;
|
||||
}
|
||||
|
||||
MemoryManager* MemoryManager::get_code_cache_memory_manager() {
|
||||
|
@ -189,6 +191,15 @@ GCMemoryManager::~GCMemoryManager() {
|
|||
delete _current_gc_stat;
|
||||
}
|
||||
|
||||
void GCMemoryManager::add_pool(MemoryPool* pool) {
|
||||
add_pool(pool, true);
|
||||
}
|
||||
|
||||
void GCMemoryManager::add_pool(MemoryPool* pool, bool always_affected_by_gc) {
|
||||
int index = MemoryManager::add_pool(pool);
|
||||
_pool_always_affected_by_gc[index] = always_affected_by_gc;
|
||||
}
|
||||
|
||||
void GCMemoryManager::initialize_gc_stat_info() {
|
||||
assert(MemoryService::num_memory_pools() > 0, "should have one or more memory pools");
|
||||
_last_gc_stat = new(ResourceObj::C_HEAP, mtGC) GCStatInfo(MemoryService::num_memory_pools());
|
||||
|
@ -230,7 +241,8 @@ void GCMemoryManager::gc_begin(bool recordGCBeginTime, bool recordPreGCUsage,
|
|||
void GCMemoryManager::gc_end(bool recordPostGCUsage,
|
||||
bool recordAccumulatedGCTime,
|
||||
bool recordGCEndTime, bool countCollection,
|
||||
GCCause::Cause cause) {
|
||||
GCCause::Cause cause,
|
||||
bool allMemoryPoolsAffected) {
|
||||
if (recordAccumulatedGCTime) {
|
||||
_accumulated_timer.stop();
|
||||
}
|
||||
|
@ -259,9 +271,11 @@ void GCMemoryManager::gc_end(bool recordPostGCUsage,
|
|||
MemoryPool* pool = get_memory_pool(i);
|
||||
MemoryUsage usage = pool->get_memory_usage();
|
||||
|
||||
// Compare with GC usage threshold
|
||||
pool->set_last_collection_usage(usage);
|
||||
LowMemoryDetector::detect_after_gc_memory(pool);
|
||||
if (allMemoryPoolsAffected || pool_always_affected_by_gc(i)) {
|
||||
// Compare with GC usage threshold
|
||||
pool->set_last_collection_usage(usage);
|
||||
LowMemoryDetector::detect_after_gc_memory(pool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue