< prev index next >
src/hotspot/share/services/memoryManager.cpp
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2003, 2017, 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.
--- 1,7 ----
/*
! * Copyright (c) 2003, 2018, 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.
*** 40,56 ****
MemoryManager::MemoryManager(const char* name) : _name(name) {
_num_pools = 0;
(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;
_num_pools++;
}
pool->add_manager(this);
}
MemoryManager* MemoryManager::get_code_cache_memory_manager() {
return new MemoryManager("CodeCacheManager");
}
--- 40,58 ----
MemoryManager::MemoryManager(const char* name) : _name(name) {
_num_pools = 0;
(void)const_cast<instanceOop&>(_memory_mgr_obj = instanceOop(NULL));
}
! 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() {
return new MemoryManager("CodeCacheManager");
}
*** 186,196 ****
delete _last_gc_stat;
delete _last_gc_lock;
delete _current_gc_stat;
}
! 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());
_current_gc_stat = new(ResourceObj::C_HEAP, mtGC) GCStatInfo(MemoryService::num_memory_pools());
// tracking concurrent collections we need two objects: one to update, and one to
// hold the publicly available "last (completed) gc" information.
--- 188,204 ----
delete _last_gc_stat;
delete _last_gc_lock;
delete _current_gc_stat;
}
! int 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;
! return index;
! }
!
! 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());
_current_gc_stat = new(ResourceObj::C_HEAP, mtGC) GCStatInfo(MemoryService::num_memory_pools());
// tracking concurrent collections we need two objects: one to update, and one to
// hold the publicly available "last (completed) gc" information.
*** 227,237 ****
// make a TraceMemoryManagerStats object where countCollection is true,
// to ensure the current gc stat is placed in _last_gc_stat.
void GCMemoryManager::gc_end(bool recordPostGCUsage,
bool recordAccumulatedGCTime,
bool recordGCEndTime, bool countCollection,
! GCCause::Cause cause) {
if (recordAccumulatedGCTime) {
_accumulated_timer.stop();
}
if (recordGCEndTime) {
_current_gc_stat->set_end_time(Management::timestamp());
--- 235,246 ----
// make a TraceMemoryManagerStats object where countCollection is true,
// to ensure the current gc stat is placed in _last_gc_stat.
void GCMemoryManager::gc_end(bool recordPostGCUsage,
bool recordAccumulatedGCTime,
bool recordGCEndTime, bool countCollection,
! GCCause::Cause cause,
! bool allMemoryPoolsAffected) {
if (recordAccumulatedGCTime) {
_accumulated_timer.stop();
}
if (recordGCEndTime) {
_current_gc_stat->set_end_time(Management::timestamp());
*** 256,270 ****
--- 265,281 ----
// Set last collection usage of the memory pools managed by this collector
for (i = 0; i < num_memory_pools(); i++) {
MemoryPool* pool = get_memory_pool(i);
MemoryUsage usage = pool->get_memory_usage();
+ 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);
}
}
+ }
if (countCollection) {
_num_collections++;
// alternately update two objects making one public when complete
{
< prev index next >