158 } |
158 } |
159 |
159 |
160 // Memory state functions. |
160 // Memory state functions. |
161 |
161 |
162 |
162 |
163 CollectedHeap::CollectedHeap() { |
163 CollectedHeap::CollectedHeap() : |
|
164 _barrier_set(NULL), |
|
165 _is_gc_active(false), |
|
166 _total_collections(0), |
|
167 _total_full_collections(0), |
|
168 _gc_cause(GCCause::_no_gc), |
|
169 _gc_lastcause(GCCause::_no_gc), |
|
170 _defer_initial_card_mark(false) // strengthened by subclass in pre_initialize() below. |
|
171 { |
164 const size_t max_len = size_t(arrayOopDesc::max_array_length(T_INT)); |
172 const size_t max_len = size_t(arrayOopDesc::max_array_length(T_INT)); |
165 const size_t elements_per_word = HeapWordSize / sizeof(jint); |
173 const size_t elements_per_word = HeapWordSize / sizeof(jint); |
166 _filler_array_max_size = align_object_size(filler_array_hdr_size() + |
174 _filler_array_max_size = align_object_size(filler_array_hdr_size() + |
167 max_len / elements_per_word); |
175 max_len / elements_per_word); |
168 |
176 |
169 _barrier_set = NULL; |
|
170 _is_gc_active = false; |
|
171 _total_collections = _total_full_collections = 0; |
|
172 _gc_cause = _gc_lastcause = GCCause::_no_gc; |
|
173 NOT_PRODUCT(_promotion_failure_alot_count = 0;) |
177 NOT_PRODUCT(_promotion_failure_alot_count = 0;) |
174 NOT_PRODUCT(_promotion_failure_alot_gc_number = 0;) |
178 NOT_PRODUCT(_promotion_failure_alot_gc_number = 0;) |
175 |
179 |
176 if (UsePerfData) { |
180 if (UsePerfData) { |
177 EXCEPTION_MARK; |
181 EXCEPTION_MARK; |
182 |
186 |
183 _perf_gc_lastcause = |
187 _perf_gc_lastcause = |
184 PerfDataManager::create_string_variable(SUN_GC, "lastCause", |
188 PerfDataManager::create_string_variable(SUN_GC, "lastCause", |
185 80, GCCause::to_string(_gc_lastcause), CHECK); |
189 80, GCCause::to_string(_gc_lastcause), CHECK); |
186 } |
190 } |
187 _defer_initial_card_mark = false; // strengthened by subclass in pre_initialize() below. |
191 |
188 // Create the ring log |
192 // Create the ring log |
189 if (LogEvents) { |
193 if (LogEvents) { |
190 _gc_heap_log = new GCHeapLog(); |
194 _gc_heap_log = new GCHeapLog(); |
191 } else { |
195 } else { |
192 _gc_heap_log = NULL; |
196 _gc_heap_log = NULL; |
568 } |
572 } |
569 |
573 |
570 void CollectedHeap::pre_full_gc_dump(GCTimer* timer) { |
574 void CollectedHeap::pre_full_gc_dump(GCTimer* timer) { |
571 if (HeapDumpBeforeFullGC) { |
575 if (HeapDumpBeforeFullGC) { |
572 GCTraceTime tt("Heap Dump (before full gc): ", PrintGCDetails, false, timer, GCId::create()); |
576 GCTraceTime tt("Heap Dump (before full gc): ", PrintGCDetails, false, timer, GCId::create()); |
573 // We are doing a "major" collection and a heap dump before |
577 // We are doing a full collection and a heap dump before |
574 // major collection has been requested. |
578 // full collection has been requested. |
575 HeapDumper::dump_heap(); |
579 HeapDumper::dump_heap(); |
576 } |
580 } |
577 if (PrintClassHistogramBeforeFullGC) { |
581 if (PrintClassHistogramBeforeFullGC) { |
578 GCTraceTime tt("Class Histogram (before full gc): ", PrintGCDetails, true, timer, GCId::create()); |
582 GCTraceTime tt("Class Histogram (before full gc): ", PrintGCDetails, true, timer, GCId::create()); |
579 VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */); |
583 VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */); |