164 f->do_oop((oop*) &_memory_mgr_obj); |
164 f->do_oop((oop*) &_memory_mgr_obj); |
165 } |
165 } |
166 |
166 |
167 GCStatInfo::GCStatInfo(int num_pools) { |
167 GCStatInfo::GCStatInfo(int num_pools) { |
168 // initialize the arrays for memory usage |
168 // initialize the arrays for memory usage |
169 _before_gc_usage_array = (MemoryUsage*) NEW_C_HEAP_ARRAY(MemoryUsage, num_pools); |
169 _before_gc_usage_array = (MemoryUsage*) NEW_C_HEAP_ARRAY(MemoryUsage, num_pools, mtInternal); |
170 _after_gc_usage_array = (MemoryUsage*) NEW_C_HEAP_ARRAY(MemoryUsage, num_pools); |
170 _after_gc_usage_array = (MemoryUsage*) NEW_C_HEAP_ARRAY(MemoryUsage, num_pools, mtInternal); |
171 _usage_array_size = num_pools; |
171 _usage_array_size = num_pools; |
172 clear(); |
172 clear(); |
173 } |
173 } |
174 |
174 |
175 GCStatInfo::~GCStatInfo() { |
175 GCStatInfo::~GCStatInfo() { |
176 FREE_C_HEAP_ARRAY(MemoryUsage*, _before_gc_usage_array); |
176 FREE_C_HEAP_ARRAY(MemoryUsage*, _before_gc_usage_array, mtInternal); |
177 FREE_C_HEAP_ARRAY(MemoryUsage*, _after_gc_usage_array); |
177 FREE_C_HEAP_ARRAY(MemoryUsage*, _after_gc_usage_array, mtInternal); |
178 } |
178 } |
179 |
179 |
180 void GCStatInfo::set_gc_usage(int pool_index, MemoryUsage usage, bool before_gc) { |
180 void GCStatInfo::set_gc_usage(int pool_index, MemoryUsage usage, bool before_gc) { |
181 MemoryUsage* gc_usage_array; |
181 MemoryUsage* gc_usage_array; |
182 if (before_gc) { |
182 if (before_gc) { |
212 delete _current_gc_stat; |
212 delete _current_gc_stat; |
213 } |
213 } |
214 |
214 |
215 void GCMemoryManager::initialize_gc_stat_info() { |
215 void GCMemoryManager::initialize_gc_stat_info() { |
216 assert(MemoryService::num_memory_pools() > 0, "should have one or more memory pools"); |
216 assert(MemoryService::num_memory_pools() > 0, "should have one or more memory pools"); |
217 _last_gc_stat = new(ResourceObj::C_HEAP) GCStatInfo(MemoryService::num_memory_pools()); |
217 _last_gc_stat = new(ResourceObj::C_HEAP, mtGC) GCStatInfo(MemoryService::num_memory_pools()); |
218 _current_gc_stat = new(ResourceObj::C_HEAP) GCStatInfo(MemoryService::num_memory_pools()); |
218 _current_gc_stat = new(ResourceObj::C_HEAP, mtGC) GCStatInfo(MemoryService::num_memory_pools()); |
219 // tracking concurrent collections we need two objects: one to update, and one to |
219 // tracking concurrent collections we need two objects: one to update, and one to |
220 // hold the publicly available "last (completed) gc" information. |
220 // hold the publicly available "last (completed) gc" information. |
221 } |
221 } |
222 |
222 |
223 void GCMemoryManager::gc_begin(bool recordGCBeginTime, bool recordPreGCUsage, |
223 void GCMemoryManager::gc_begin(bool recordGCBeginTime, bool recordPreGCUsage, |