53 }
54
55 MemoryUsage get_memory_usage() {
56 size_t max_heap_size = (available_for_allocation() ? max_size() : 0);
57 size_t used = used_in_bytes();
58 size_t committed = _space->capacity();
59
60 return MemoryUsage(initial_size(), used, committed, max_heap_size);
61 }
62
63 size_t used_in_bytes() {
64 return _space->used();
65 }
66 };
67
68 CMSHeap::CMSHeap(GenCollectorPolicy *policy) :
69 GenCollectedHeap(policy,
70 Generation::ParNew,
71 Generation::ConcurrentMarkSweep,
72 "ParNew:CMS"),
73 _eden_pool(NULL),
74 _survivor_pool(NULL),
75 _old_pool(NULL) {
76 _workers = new WorkGang("GC Thread", ParallelGCThreads,
77 /* are_GC_task_threads */true,
78 /* are_ConcurrentGC_threads */false);
79 _workers->initialize_workers();
80 }
81
82 jint CMSHeap::initialize() {
83 jint status = GenCollectedHeap::initialize();
84 if (status != JNI_OK) return status;
85
86 // If we are running CMS, create the collector responsible
87 // for collecting the CMS generations.
88 if (!create_cms_collector()) {
89 return JNI_ENOMEM;
90 }
91
92 return JNI_OK;
93 }
94
95 CardTableRS* CMSHeap::create_rem_set(const MemRegion& reserved_region) {
96 return new CMSCardTable(reserved_region);
97 }
98
99 void CMSHeap::initialize_serviceability() {
100 _young_manager = new GCMemoryManager("ParNew", "end of minor GC");
101 _old_manager = new GCMemoryManager("ConcurrentMarkSweep", "end of major GC");
102
103 ParNewGeneration* young = young_gen();
104 _eden_pool = new ContiguousSpacePool(young->eden(),
|
53 }
54
55 MemoryUsage get_memory_usage() {
56 size_t max_heap_size = (available_for_allocation() ? max_size() : 0);
57 size_t used = used_in_bytes();
58 size_t committed = _space->capacity();
59
60 return MemoryUsage(initial_size(), used, committed, max_heap_size);
61 }
62
63 size_t used_in_bytes() {
64 return _space->used();
65 }
66 };
67
68 CMSHeap::CMSHeap(GenCollectorPolicy *policy) :
69 GenCollectedHeap(policy,
70 Generation::ParNew,
71 Generation::ConcurrentMarkSweep,
72 "ParNew:CMS"),
73 _workers(NULL),
74 _eden_pool(NULL),
75 _survivor_pool(NULL),
76 _old_pool(NULL) {
77 }
78
79 jint CMSHeap::initialize() {
80 jint status = GenCollectedHeap::initialize();
81 if (status != JNI_OK) return status;
82
83 _workers = new WorkGang("GC Thread", ParallelGCThreads,
84 /* are_GC_task_threads */true,
85 /* are_ConcurrentGC_threads */false);
86 if (_workers == NULL) {
87 return JNI_ENOMEM;
88 }
89 _workers->initialize_workers();
90
91 // If we are running CMS, create the collector responsible
92 // for collecting the CMS generations.
93 if (!create_cms_collector()) {
94 return JNI_ENOMEM;
95 }
96
97 return JNI_OK;
98 }
99
100 CardTableRS* CMSHeap::create_rem_set(const MemRegion& reserved_region) {
101 return new CMSCardTable(reserved_region);
102 }
103
104 void CMSHeap::initialize_serviceability() {
105 _young_manager = new GCMemoryManager("ParNew", "end of minor GC");
106 _old_manager = new GCMemoryManager("ConcurrentMarkSweep", "end of major GC");
107
108 ParNewGeneration* young = young_gen();
109 _eden_pool = new ContiguousSpacePool(young->eden(),
|