/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*
*/
#include "precompiled.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "gc_implementation/shared/mutableSpace.hpp"
#include "memory/collectorPolicy.hpp"
#include "memory/defNewGeneration.hpp"
#include "memory/genCollectedHeap.hpp"
#include "memory/generation.hpp"
#include "memory/generationSpec.hpp"
#include "memory/memRegion.hpp"
#include "memory/permGen.hpp"
#include "memory/tenuredGeneration.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/javaCalls.hpp"
#include "services/classLoadingService.hpp"
#include "services/lowMemoryDetector.hpp"
#include "services/management.hpp"
#include "services/memoryManager.hpp"
#include "services/memoryPool.hpp"
#include "services/memoryService.hpp"
#include "utilities/growableArray.hpp"
#ifndef SERIALGC
#include "gc_implementation/concurrentMarkSweep/cmsPermGen.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/parNew/parNewGeneration.hpp"
#include "gc_implementation/parallelScavenge/psOldGen.hpp"
#include "gc_implementation/parallelScavenge/psPermGen.hpp"
#include "gc_implementation/parallelScavenge/psYoungGen.hpp"
#include "services/g1MemoryPool.hpp"
#include "services/psMemoryPool.hpp"
#endif
private:
int _count;
public:
};
_count++;
}
switch (kind) {
case CollectedHeap::GenCollectedHeap : {
break;
}
#ifndef SERIALGC
case CollectedHeap::ParallelScavengeHeap : {
break;
}
case CollectedHeap::G1CollectedHeap : {
break;
}
#endif // SERIALGC
default: {
guarantee(false, "Unrecognized kind of heap");
}
}
// set the GC thread count
if (count > 0) {
}
// All memory pools and memory managers are initialized.
//
}
// Add memory pools for GenCollectedHeap
// This function currently only supports two generations collected heap.
// The collector for GenCollectedHeap will have two memory managers.
if (two_gen_policy != NULL) {
switch (kind) {
case Generation::DefNew:
break;
#ifndef SERIALGC
case Generation::ParNew:
case Generation::ASParNew:
break;
#endif // SERIALGC
default:
guarantee(false, "Unrecognized generation spec");
break;
}
if (policy->is_mark_sweep_policy()) {
#ifndef SERIALGC
} else if (policy->is_concurrent_mark_sweep_policy()) {
#endif // SERIALGC
} else {
guarantee(false, "Unknown two-gen policy");
}
} else {
guarantee(false, "Non two-gen policy");
}
switch (name) {
case PermGen::MarkSweepCompact: {
break;
}
#ifndef SERIALGC
case PermGen::ConcurrentMarkSweep: {
break;
}
#endif // SERIALGC
default:
guarantee(false, "Unrecognized perm generation");
break;
}
}
#ifndef SERIALGC
// Add memory pools for ParallelScavengeHeap
// This function currently only supports two generations collected heap.
// The collector for ParallelScavengeHeap will have two memory managers.
// Two managers to keep statistics about _minor_gc_manager and _major_gc_manager GC.
}
}
#endif // SERIALGC
const char* name,
bool is_heap,
bool support_usage_threshold) {
return (MemoryPool*) pool;
}
const char* name,
bool is_heap,
bool support_usage_threshold) {
ContiguousSpacePool* pool = new ContiguousSpacePool(space, name, type, max_size, support_usage_threshold);
return (MemoryPool*) pool;
}
const char* name,
bool is_heap,
bool support_usage_threshold) {
SurvivorContiguousSpacePool* pool = new SurvivorContiguousSpacePool(gen, name, type, max_size, support_usage_threshold);
return (MemoryPool*) pool;
}
#ifndef SERIALGC
const char* name,
bool is_heap,
bool support_usage_threshold) {
CompactibleFreeListSpacePool* pool = new CompactibleFreeListSpacePool(space, name, type, max_size, support_usage_threshold);
return (MemoryPool*) pool;
}
#endif // SERIALGC
// Add memory pool(s) for one generation
switch (kind) {
case Generation::DefNew: {
// Add a memory pool for each space and young gen doesn't
// support low memory detection as it is expected to get filled up.
"Eden Space",
true, /* is_heap */
false /* support_usage_threshold */);
"Survivor Space",
true, /* is_heap */
false /* support_usage_threshold */);
break;
}
#ifndef SERIALGC
case Generation::ParNew:
case Generation::ASParNew:
{
// Add a memory pool for each space and young gen doesn't
// support low memory detection as it is expected to get filled up.
"Par Eden Space",
true /* is_heap */,
false /* support_usage_threshold */);
"Par Survivor Space",
true, /* is_heap */
false /* support_usage_threshold */);
break;
}
#endif // SERIALGC
case Generation::MarkSweepCompact: {
"Tenured Gen",
true, /* is_heap */
true /* support_usage_threshold */);
break;
}
#ifndef SERIALGC
case Generation::ConcurrentMarkSweep:
case Generation::ASConcurrentMarkSweep:
{
"CMS Old Gen",
true, /* is_heap */
true /* support_usage_threshold */);
break;
}
#endif // SERIALGC
default:
assert(false, "should not reach here");
// no memory pool added for others
break;
}
// Link managers and the memory pools together
}
}
}
MemoryManager* mgr) {
"Perm Gen",
false, /* is_heap */
true /* support_usage_threshold */);
if (UseSharedSpaces) {
"Perm Gen [shared-ro]",
false, /* is_heap */
spec->read_only_size(),
true /* support_usage_threshold */);
"Perm Gen [shared-rw]",
false, /* is_heap */
spec->read_write_size(),
true /* support_usage_threshold */);
}
}
#ifndef SERIALGC
MemoryManager* mgr) {
"CMS Perm Gen",
false, /* is_heap */
true /* support_usage_threshold */);
}
void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) {
// Add a memory pool for each space and young gen doesn't
// support low memory detection as it is expected to get filled up.
gen->eden_space(),
"PS Eden Space",
false /* support_usage_threshold */);
"PS Survivor Space",
false /* support_usage_threshold */);
}
"PS Old Gen",
true /* support_usage_threshold */);
}
"PS Perm Gen",
true /* support_usage_threshold */);
}
}
MemoryManager* mgr) {
}
MemoryManager* mgr) {
- spec->read_write_size();
"G1 Perm Gen",
false, /* is_heap */
true /* support_usage_threshold */);
// in case we support CDS in G1
if (UseSharedSpaces) {
"G1 Perm Gen [shared-ro]",
false, /* is_heap */
spec->read_only_size(),
true /* support_usage_threshold */);
"G1 Perm Gen [shared-rw]",
false, /* is_heap */
spec->read_write_size(),
true /* support_usage_threshold */);
}
}
#endif // SERIALGC
"Code Cache",
true /* support_usage_threshold */);
}
for (int i = 0; i < _managers_list->length(); i++) {
return mgr;
}
}
return NULL;
}
for (int i = 0; i < _pools_list->length(); i++) {
return pool;
}
}
return NULL;
}
// Track the peak memory usage
for (int i = 0; i < _pools_list->length(); i++) {
}
// Detect low memory
}
// Track the peak memory usage
// Detect low memory
}
}
bool recordAccumulatedGCTime,
bool recordPreGCUsage, bool recordPeakUsage) {
if (fullGC) {
} else {
}
// Track the peak memory usage when GC begins
if (recordPeakUsage) {
for (int i = 0; i < _pools_list->length(); i++) {
}
}
}
bool recordAccumulatedGCTime,
bool recordGCEndTime, bool countCollection,
if (fullGC) {
} else {
}
// register the GC end statistics and memory usage
}
int i;
for (i = 0; i < _pools_list->length(); i++) {
}
for (i = 0; i < _managers_list->length(); i++) {
}
}
// verbose will be set to the previous value
return verbose;
}
ik,
&args,
CHECK_NH);
return obj;
}
//
// GC manager type depends on the type of Generation. Depending on the space
// availablity and vm options the gc uses major gc manager or minor gc
// manager or both. The type of gc manager depends on the generation kind.
// For DefNew, ParNew and ASParNew generation doing scavenge gc uses minor
// gc manager (so _fullGC is set to false ) and for other generation kinds
// doing mark-sweep-compact uses major gc manager (so _fullGC is set
// to true).
switch (kind) {
case Generation::DefNew:
#ifndef SERIALGC
case Generation::ParNew:
case Generation::ASParNew:
#endif // SERIALGC
_fullGC=false;
break;
case Generation::MarkSweepCompact:
#ifndef SERIALGC
case Generation::ConcurrentMarkSweep:
case Generation::ASConcurrentMarkSweep:
#endif // SERIALGC
_fullGC=true;
break;
default:
assert(false, "Unrecognized gc generation kind.");
}
// this has to be called in a stop the world pause and represent
// an entire gc pause, start to finish:
}
bool recordGCBeginTime,
bool recordPreGCUsage,
bool recordPeakUsage,
bool recordPostGCUsage,
bool recordAccumulatedGCTime,
bool recordGCEndTime,
bool countCollection) {
}
// for a subclass to create then initialize an instance before invoking
// the MemoryService
bool recordGCBeginTime,
bool recordPreGCUsage,
bool recordPeakUsage,
bool recordPostGCUsage,
bool recordAccumulatedGCTime,
bool recordGCEndTime,
bool countCollection) {
}
}