49 CollectedMemoryPool(name, space->capacity(), max_size, support_usage_threshold),
50 _space(space) {
51 }
52
53 MemoryUsage get_memory_usage() {
54 size_t max_heap_size = (available_for_allocation() ? max_size() : 0);
55 size_t used = used_in_bytes();
56 size_t committed = _space->capacity();
57
58 return MemoryUsage(initial_size(), used, committed, max_heap_size);
59 }
60
61 size_t used_in_bytes() {
62 return _space->used();
63 }
64 };
65
66 CMSHeap::CMSHeap(GenCollectorPolicy *policy) :
67 GenCollectedHeap(policy,
68 Generation::ParNew,
69 Generation::ConcurrentMarkSweep),
70 _eden_pool(NULL),
71 _survivor_pool(NULL),
72 _old_pool(NULL) {
73 _workers = new WorkGang("GC Thread", ParallelGCThreads,
74 /* are_GC_task_threads */true,
75 /* are_ConcurrentGC_threads */false);
76 _workers->initialize_workers();
77 }
78
79 jint CMSHeap::initialize() {
80 jint status = GenCollectedHeap::initialize();
81 if (status != JNI_OK) return status;
82
83 // If we are running CMS, create the collector responsible
84 // for collecting the CMS generations.
85 if (!create_cms_collector()) {
86 return JNI_ENOMEM;
87 }
88
89 return JNI_OK;
|
49 CollectedMemoryPool(name, space->capacity(), max_size, support_usage_threshold),
50 _space(space) {
51 }
52
53 MemoryUsage get_memory_usage() {
54 size_t max_heap_size = (available_for_allocation() ? max_size() : 0);
55 size_t used = used_in_bytes();
56 size_t committed = _space->capacity();
57
58 return MemoryUsage(initial_size(), used, committed, max_heap_size);
59 }
60
61 size_t used_in_bytes() {
62 return _space->used();
63 }
64 };
65
66 CMSHeap::CMSHeap(GenCollectorPolicy *policy) :
67 GenCollectedHeap(policy,
68 Generation::ParNew,
69 Generation::ConcurrentMarkSweep,
70 "ParNew::CMS"),
71 _eden_pool(NULL),
72 _survivor_pool(NULL),
73 _old_pool(NULL) {
74 _workers = new WorkGang("GC Thread", ParallelGCThreads,
75 /* are_GC_task_threads */true,
76 /* are_ConcurrentGC_threads */false);
77 _workers->initialize_workers();
78 }
79
80 jint CMSHeap::initialize() {
81 jint status = GenCollectedHeap::initialize();
82 if (status != JNI_OK) return status;
83
84 // If we are running CMS, create the collector responsible
85 // for collecting the CMS generations.
86 if (!create_cms_collector()) {
87 return JNI_ENOMEM;
88 }
89
90 return JNI_OK;
|