1 /* 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "classfile/systemDictionary.hpp" 27 #include "classfile/vmSymbols.hpp" 28 #include "gc_implementation/shared/mutableSpace.hpp" 29 #include "memory/collectorPolicy.hpp" 30 #include "memory/defNewGeneration.hpp" 31 #include "memory/genCollectedHeap.hpp" 32 #include "memory/generation.hpp" 33 #include "memory/generationSpec.hpp" 34 #include "memory/heap.hpp" 35 #include "memory/memRegion.hpp" 36 #include "memory/tenuredGeneration.hpp" 37 #include "oops/oop.inline.hpp" 38 #include "runtime/javaCalls.hpp" 39 #include "services/classLoadingService.hpp" 40 #include "services/lowMemoryDetector.hpp" 41 #include "services/management.hpp" 42 #include "services/memoryManager.hpp" 43 #include "services/memoryPool.hpp" 44 #include "services/memoryService.hpp" 45 #include "utilities/growableArray.hpp" 46 #include "utilities/macros.hpp" 47 #if INCLUDE_ALL_GCS 48 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp" 49 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" 50 #include "gc_implementation/parNew/parNewGeneration.hpp" 51 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" 52 #include "gc_implementation/parallelScavenge/psOldGen.hpp" 53 #include "gc_implementation/parallelScavenge/psYoungGen.hpp" 54 #include "services/g1MemoryPool.hpp" 55 #include "services/psMemoryPool.hpp" 56 #endif // INCLUDE_ALL_GCS 57 58 GrowableArray<MemoryPool*>* MemoryService::_pools_list = 59 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryPool*>(init_pools_list_size, true); 60 GrowableArray<MemoryManager*>* MemoryService::_managers_list = 61 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryManager*>(init_managers_list_size, true); 62 63 GCMemoryManager* MemoryService::_minor_gc_manager = NULL; 64 GCMemoryManager* MemoryService::_major_gc_manager = NULL; 65 MemoryPool* MemoryService::_code_heap_pool = NULL; 66 MemoryPool* MemoryService::_metaspace_pool = NULL; 67 MemoryPool* MemoryService::_class_metaspace_pool = NULL; 68 69 class GcThreadCountClosure: public ThreadClosure { 70 private: 71 int _count; 72 public: 73 GcThreadCountClosure() : _count(0) {}; 74 void do_thread(Thread* thread); 75 int count() { return _count; } 76 }; 77 78 void GcThreadCountClosure::do_thread(Thread* thread) { 79 _count++; 80 } 81 82 void MemoryService::set_universe_heap(CollectedHeap* heap) { 83 CollectedHeap::Name kind = heap->kind(); 84 switch (kind) { 85 case CollectedHeap::GenCollectedHeap : { 86 add_gen_collected_heap_info(GenCollectedHeap::heap()); 87 break; 88 } 89 #if INCLUDE_ALL_GCS 90 case CollectedHeap::ParallelScavengeHeap : { 91 add_parallel_scavenge_heap_info(ParallelScavengeHeap::heap()); 92 break; 93 } 94 case CollectedHeap::G1CollectedHeap : { 95 add_g1_heap_info(G1CollectedHeap::heap()); 96 break; 97 } 98 #endif // INCLUDE_ALL_GCS 99 default: { 100 guarantee(false, "Unrecognized kind of heap"); 101 } 102 } 103 104 // set the GC thread count 105 GcThreadCountClosure gctcc; 106 heap->gc_threads_do(&gctcc); 107 int count = gctcc.count(); 108 if (count > 0) { 109 _minor_gc_manager->set_num_gc_threads(count); 110 _major_gc_manager->set_num_gc_threads(count); 111 } 112 113 // All memory pools and memory managers are initialized. 114 // 115 _minor_gc_manager->initialize_gc_stat_info(); 116 _major_gc_manager->initialize_gc_stat_info(); 117 } 118 119 // Add memory pools for GenCollectedHeap 120 // This function currently only supports two generations collected heap. 121 // The collector for GenCollectedHeap will have two memory managers. 122 void MemoryService::add_gen_collected_heap_info(GenCollectedHeap* heap) { 123 CollectorPolicy* policy = heap->collector_policy(); 124 125 assert(policy->is_two_generation_policy(), "Only support two generations"); 126 guarantee(heap->n_gens() == 2, "Only support two-generation heap"); 127 128 TwoGenerationCollectorPolicy* two_gen_policy = policy->as_two_generation_policy(); 129 if (two_gen_policy != NULL) { 130 GenerationSpec** specs = two_gen_policy->generations(); 131 Generation::Name kind = specs[0]->name(); 132 switch (kind) { 133 case Generation::DefNew: 134 _minor_gc_manager = MemoryManager::get_copy_memory_manager(); 135 break; 136 #if INCLUDE_ALL_GCS 137 case Generation::ParNew: 138 case Generation::ASParNew: 139 _minor_gc_manager = MemoryManager::get_parnew_memory_manager(); 140 break; 141 #endif // INCLUDE_ALL_GCS 142 default: 143 guarantee(false, "Unrecognized generation spec"); 144 break; 145 } 146 if (policy->is_mark_sweep_policy()) { 147 _major_gc_manager = MemoryManager::get_msc_memory_manager(); 148 #if INCLUDE_ALL_GCS 149 } else if (policy->is_concurrent_mark_sweep_policy()) { 150 _major_gc_manager = MemoryManager::get_cms_memory_manager(); 151 #endif // INCLUDE_ALL_GCS 152 } else { 153 guarantee(false, "Unknown two-gen policy"); 154 } 155 } else { 156 guarantee(false, "Non two-gen policy"); 157 } 158 _managers_list->append(_minor_gc_manager); 159 _managers_list->append(_major_gc_manager); 160 161 add_generation_memory_pool(heap->get_gen(minor), _major_gc_manager, _minor_gc_manager); 162 add_generation_memory_pool(heap->get_gen(major), _major_gc_manager); 163 } 164 165 #if INCLUDE_ALL_GCS 166 // Add memory pools for ParallelScavengeHeap 167 // This function currently only supports two generations collected heap. 168 // The collector for ParallelScavengeHeap will have two memory managers. 169 void MemoryService::add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap) { 170 // Two managers to keep statistics about _minor_gc_manager and _major_gc_manager GC. 171 _minor_gc_manager = MemoryManager::get_psScavenge_memory_manager(); 172 _major_gc_manager = MemoryManager::get_psMarkSweep_memory_manager(); 173 _managers_list->append(_minor_gc_manager); 174 _managers_list->append(_major_gc_manager); 175 176 add_psYoung_memory_pool(heap->young_gen(), _major_gc_manager, _minor_gc_manager); 177 add_psOld_memory_pool(heap->old_gen(), _major_gc_manager); 178 } 179 180 void MemoryService::add_g1_heap_info(G1CollectedHeap* g1h) { 181 assert(UseG1GC, "sanity"); 182 183 _minor_gc_manager = MemoryManager::get_g1YoungGen_memory_manager(); 184 _major_gc_manager = MemoryManager::get_g1OldGen_memory_manager(); 185 _managers_list->append(_minor_gc_manager); 186 _managers_list->append(_major_gc_manager); 187 188 add_g1YoungGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager); 189 add_g1OldGen_memory_pool(g1h, _major_gc_manager); 190 } 191 #endif // INCLUDE_ALL_GCS 192 193 MemoryPool* MemoryService::add_gen(Generation* gen, 194 const char* name, 195 bool is_heap, 196 bool support_usage_threshold) { 197 198 MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); 199 GenerationPool* pool = new GenerationPool(gen, name, type, support_usage_threshold); 200 _pools_list->append(pool); 201 return (MemoryPool*) pool; 202 } 203 204 MemoryPool* MemoryService::add_space(ContiguousSpace* space, 205 const char* name, 206 bool is_heap, 207 size_t max_size, 208 bool support_usage_threshold) { 209 MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); 210 ContiguousSpacePool* pool = new ContiguousSpacePool(space, name, type, max_size, support_usage_threshold); 211 212 _pools_list->append(pool); 213 return (MemoryPool*) pool; 214 } 215 216 MemoryPool* MemoryService::add_survivor_spaces(DefNewGeneration* gen, 217 const char* name, 218 bool is_heap, 219 size_t max_size, 220 bool support_usage_threshold) { 221 MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); 222 SurvivorContiguousSpacePool* pool = new SurvivorContiguousSpacePool(gen, name, type, max_size, support_usage_threshold); 223 224 _pools_list->append(pool); 225 return (MemoryPool*) pool; 226 } 227 228 #if INCLUDE_ALL_GCS 229 MemoryPool* MemoryService::add_cms_space(CompactibleFreeListSpace* space, 230 const char* name, 231 bool is_heap, 232 size_t max_size, 233 bool support_usage_threshold) { 234 MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); 235 CompactibleFreeListSpacePool* pool = new CompactibleFreeListSpacePool(space, name, type, max_size, support_usage_threshold); 236 _pools_list->append(pool); 237 return (MemoryPool*) pool; 238 } 239 #endif // INCLUDE_ALL_GCS 240 241 // Add memory pool(s) for one generation 242 void MemoryService::add_generation_memory_pool(Generation* gen, 243 MemoryManager* major_mgr, 244 MemoryManager* minor_mgr) { 245 Generation::Name kind = gen->kind(); 246 int index = _pools_list->length(); 247 248 switch (kind) { 249 case Generation::DefNew: { 250 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); 251 DefNewGeneration* young_gen = (DefNewGeneration*) gen; 252 // Add a memory pool for each space and young gen doesn't 253 // support low memory detection as it is expected to get filled up. 254 MemoryPool* eden = add_space(young_gen->eden(), 255 "Eden Space", 256 true, /* is_heap */ 257 young_gen->max_eden_size(), 258 false /* support_usage_threshold */); 259 MemoryPool* survivor = add_survivor_spaces(young_gen, 260 "Survivor Space", 261 true, /* is_heap */ 262 young_gen->max_survivor_size(), 263 false /* support_usage_threshold */); 264 break; 265 } 266 267 #if INCLUDE_ALL_GCS 268 case Generation::ParNew: 269 case Generation::ASParNew: 270 { 271 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); 272 // Add a memory pool for each space and young gen doesn't 273 // support low memory detection as it is expected to get filled up. 274 ParNewGeneration* parnew_gen = (ParNewGeneration*) gen; 275 MemoryPool* eden = add_space(parnew_gen->eden(), 276 "Par Eden Space", 277 true /* is_heap */, 278 parnew_gen->max_eden_size(), 279 false /* support_usage_threshold */); 280 MemoryPool* survivor = add_survivor_spaces(parnew_gen, 281 "Par Survivor Space", 282 true, /* is_heap */ 283 parnew_gen->max_survivor_size(), 284 false /* support_usage_threshold */); 285 286 break; 287 } 288 #endif // INCLUDE_ALL_GCS 289 290 case Generation::MarkSweepCompact: { 291 assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); 292 add_gen(gen, 293 "Tenured Gen", 294 true, /* is_heap */ 295 true /* support_usage_threshold */); 296 break; 297 } 298 299 #if INCLUDE_ALL_GCS 300 case Generation::ConcurrentMarkSweep: 301 case Generation::ASConcurrentMarkSweep: 302 { 303 assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); 304 ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*) gen; 305 MemoryPool* pool = add_cms_space(cms->cmsSpace(), 306 "CMS Old Gen", 307 true, /* is_heap */ 308 cms->reserved().byte_size(), 309 true /* support_usage_threshold */); 310 break; 311 } 312 #endif // INCLUDE_ALL_GCS 313 314 default: 315 assert(false, "should not reach here"); 316 // no memory pool added for others 317 break; 318 } 319 320 assert(major_mgr != NULL, "Should have at least one manager"); 321 // Link managers and the memory pools together 322 for (int i = index; i < _pools_list->length(); i++) { 323 MemoryPool* pool = _pools_list->at(i); 324 major_mgr->add_pool(pool); 325 if (minor_mgr != NULL) { 326 minor_mgr->add_pool(pool); 327 } 328 } 329 } 330 331 332 #if INCLUDE_ALL_GCS 333 void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) { 334 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); 335 336 // Add a memory pool for each space and young gen doesn't 337 // support low memory detection as it is expected to get filled up. 338 EdenMutableSpacePool* eden = new EdenMutableSpacePool(gen, 339 gen->eden_space(), 340 "PS Eden Space", 341 MemoryPool::Heap, 342 false /* support_usage_threshold */); 343 344 SurvivorMutableSpacePool* survivor = new SurvivorMutableSpacePool(gen, 345 "PS Survivor Space", 346 MemoryPool::Heap, 347 false /* support_usage_threshold */); 348 349 major_mgr->add_pool(eden); 350 major_mgr->add_pool(survivor); 351 minor_mgr->add_pool(eden); 352 minor_mgr->add_pool(survivor); 353 _pools_list->append(eden); 354 _pools_list->append(survivor); 355 } 356 357 void MemoryService::add_psOld_memory_pool(PSOldGen* gen, MemoryManager* mgr) { 358 PSGenerationPool* old_gen = new PSGenerationPool(gen, 359 "PS Old Gen", 360 MemoryPool::Heap, 361 true /* support_usage_threshold */); 362 mgr->add_pool(old_gen); 363 _pools_list->append(old_gen); 364 } 365 366 void MemoryService::add_g1YoungGen_memory_pool(G1CollectedHeap* g1h, 367 MemoryManager* major_mgr, 368 MemoryManager* minor_mgr) { 369 assert(major_mgr != NULL && minor_mgr != NULL, "should have two managers"); 370 371 G1EdenPool* eden = new G1EdenPool(g1h); 372 G1SurvivorPool* survivor = new G1SurvivorPool(g1h); 373 374 major_mgr->add_pool(eden); 375 major_mgr->add_pool(survivor); 376 minor_mgr->add_pool(eden); 377 minor_mgr->add_pool(survivor); 378 _pools_list->append(eden); 379 _pools_list->append(survivor); 380 } 381 382 void MemoryService::add_g1OldGen_memory_pool(G1CollectedHeap* g1h, 383 MemoryManager* mgr) { 384 assert(mgr != NULL, "should have one manager"); 385 386 G1OldGenPool* old_gen = new G1OldGenPool(g1h); 387 mgr->add_pool(old_gen); 388 _pools_list->append(old_gen); 389 } 390 #endif // INCLUDE_ALL_GCS 391 392 void MemoryService::add_code_heap_memory_pool(CodeHeap* heap) { 393 _code_heap_pool = new CodeHeapPool(heap, 394 "Code Cache", 395 true /* support_usage_threshold */); 396 MemoryManager* mgr = MemoryManager::get_code_cache_memory_manager(); 397 mgr->add_pool(_code_heap_pool); 398 399 _pools_list->append(_code_heap_pool); 400 _managers_list->append(mgr); 401 } 402 403 void MemoryService::add_metaspace_memory_pools() { 404 _metaspace_pool = new MetaspacePool(); 405 _class_metaspace_pool = new ClassMetaspacePool(); 406 407 MemoryManager* mgr = MemoryManager::get_metaspace_memory_manager(); 408 mgr->add_pool(_metaspace_pool); 409 mgr->add_pool(_class_metaspace_pool); 410 411 _pools_list->append(_metaspace_pool); 412 _pools_list->append(_class_metaspace_pool); 413 _managers_list->append(mgr); 414 } 415 416 MemoryManager* MemoryService::get_memory_manager(instanceHandle mh) { 417 for (int i = 0; i < _managers_list->length(); i++) { 418 MemoryManager* mgr = _managers_list->at(i); 419 if (mgr->is_manager(mh)) { 420 return mgr; 421 } 422 } 423 return NULL; 424 } 425 426 MemoryPool* MemoryService::get_memory_pool(instanceHandle ph) { 427 for (int i = 0; i < _pools_list->length(); i++) { 428 MemoryPool* pool = _pools_list->at(i); 429 if (pool->is_pool(ph)) { 430 return pool; 431 } 432 } 433 return NULL; 434 } 435 436 void MemoryService::track_memory_usage() { 437 // Track the peak memory usage 438 for (int i = 0; i < _pools_list->length(); i++) { 439 MemoryPool* pool = _pools_list->at(i); 440 pool->record_peak_memory_usage(); 441 } 442 443 // Detect low memory 444 LowMemoryDetector::detect_low_memory(); 445 } 446 447 void MemoryService::track_memory_pool_usage(MemoryPool* pool) { 448 // Track the peak memory usage 449 pool->record_peak_memory_usage(); 450 451 // Detect low memory 452 if (LowMemoryDetector::is_enabled(pool)) { 453 LowMemoryDetector::detect_low_memory(pool); 454 } 455 } 456 457 void MemoryService::gc_begin(bool fullGC, bool recordGCBeginTime, 458 bool recordAccumulatedGCTime, 459 bool recordPreGCUsage, bool recordPeakUsage) { 460 461 GCMemoryManager* mgr; 462 if (fullGC) { 463 mgr = _major_gc_manager; 464 } else { 465 mgr = _minor_gc_manager; 466 } 467 assert(mgr->is_gc_memory_manager(), "Sanity check"); 468 mgr->gc_begin(recordGCBeginTime, recordPreGCUsage, recordAccumulatedGCTime); 469 470 // Track the peak memory usage when GC begins 471 if (recordPeakUsage) { 472 for (int i = 0; i < _pools_list->length(); i++) { 473 MemoryPool* pool = _pools_list->at(i); 474 pool->record_peak_memory_usage(); 475 } 476 } 477 } 478 479 void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage, 480 bool recordAccumulatedGCTime, 481 bool recordGCEndTime, bool countCollection, 482 GCCause::Cause cause) { 483 484 GCMemoryManager* mgr; 485 if (fullGC) { 486 mgr = (GCMemoryManager*) _major_gc_manager; 487 } else { 488 mgr = (GCMemoryManager*) _minor_gc_manager; 489 } 490 assert(mgr->is_gc_memory_manager(), "Sanity check"); 491 492 // register the GC end statistics and memory usage 493 mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, 494 countCollection, cause); 495 } 496 497 void MemoryService::oops_do(OopClosure* f) { 498 int i; 499 500 for (i = 0; i < _pools_list->length(); i++) { 501 MemoryPool* pool = _pools_list->at(i); 502 pool->oops_do(f); 503 } 504 for (i = 0; i < _managers_list->length(); i++) { 505 MemoryManager* mgr = _managers_list->at(i); 506 mgr->oops_do(f); 507 } 508 } 509 510 bool MemoryService::set_verbose(bool verbose) { 511 MutexLocker m(Management_lock); 512 // verbose will be set to the previous value 513 bool succeed = CommandLineFlags::boolAtPut((char*)"PrintGC", &verbose, MANAGEMENT); 514 assert(succeed, "Setting PrintGC flag fails"); 515 ClassLoadingService::reset_trace_class_unloading(); 516 517 return verbose; 518 } 519 520 Handle MemoryService::create_MemoryUsage_obj(MemoryUsage usage, TRAPS) { 521 Klass* k = Management::java_lang_management_MemoryUsage_klass(CHECK_NH); 522 instanceKlassHandle ik(THREAD, k); 523 524 instanceHandle obj = ik->allocate_instance_handle(CHECK_NH); 525 526 JavaValue result(T_VOID); 527 JavaCallArguments args(10); 528 args.push_oop(obj); // receiver 529 args.push_long(usage.init_size_as_jlong()); // Argument 1 530 args.push_long(usage.used_as_jlong()); // Argument 2 531 args.push_long(usage.committed_as_jlong()); // Argument 3 532 args.push_long(usage.max_size_as_jlong()); // Argument 4 533 534 JavaCalls::call_special(&result, 535 ik, 536 vmSymbols::object_initializer_name(), 537 vmSymbols::long_long_long_long_void_signature(), 538 &args, 539 CHECK_NH); 540 return obj; 541 } 542 // 543 // GC manager type depends on the type of Generation. Depending on the space 544 // availablity and vm options the gc uses major gc manager or minor gc 545 // manager or both. The type of gc manager depends on the generation kind. 546 // For DefNew, ParNew and ASParNew generation doing scavenge gc uses minor 547 // gc manager (so _fullGC is set to false ) and for other generation kinds 548 // doing mark-sweep-compact uses major gc manager (so _fullGC is set 549 // to true). 550 TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause) { 551 switch (kind) { 552 case Generation::DefNew: 553 #if INCLUDE_ALL_GCS 554 case Generation::ParNew: 555 case Generation::ASParNew: 556 #endif // INCLUDE_ALL_GCS 557 _fullGC=false; 558 break; 559 case Generation::MarkSweepCompact: 560 #if INCLUDE_ALL_GCS 561 case Generation::ConcurrentMarkSweep: 562 case Generation::ASConcurrentMarkSweep: 563 #endif // INCLUDE_ALL_GCS 564 _fullGC=true; 565 break; 566 default: 567 assert(false, "Unrecognized gc generation kind."); 568 } 569 // this has to be called in a stop the world pause and represent 570 // an entire gc pause, start to finish: 571 initialize(_fullGC, cause,true, true, true, true, true, true, true); 572 } 573 TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC, 574 GCCause::Cause cause, 575 bool recordGCBeginTime, 576 bool recordPreGCUsage, 577 bool recordPeakUsage, 578 bool recordPostGCUsage, 579 bool recordAccumulatedGCTime, 580 bool recordGCEndTime, 581 bool countCollection) { 582 initialize(fullGC, cause, recordGCBeginTime, recordPreGCUsage, recordPeakUsage, 583 recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, 584 countCollection); 585 } 586 587 // for a subclass to create then initialize an instance before invoking 588 // the MemoryService 589 void TraceMemoryManagerStats::initialize(bool fullGC, 590 GCCause::Cause cause, 591 bool recordGCBeginTime, 592 bool recordPreGCUsage, 593 bool recordPeakUsage, 594 bool recordPostGCUsage, 595 bool recordAccumulatedGCTime, 596 bool recordGCEndTime, 597 bool countCollection) { 598 _fullGC = fullGC; 599 _recordGCBeginTime = recordGCBeginTime; 600 _recordPreGCUsage = recordPreGCUsage; 601 _recordPeakUsage = recordPeakUsage; 602 _recordPostGCUsage = recordPostGCUsage; 603 _recordAccumulatedGCTime = recordAccumulatedGCTime; 604 _recordGCEndTime = recordGCEndTime; 605 _countCollection = countCollection; 606 _cause = cause; 607 608 MemoryService::gc_begin(_fullGC, _recordGCBeginTime, _recordAccumulatedGCTime, 609 _recordPreGCUsage, _recordPeakUsage); 610 } 611 612 TraceMemoryManagerStats::~TraceMemoryManagerStats() { 613 MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime, 614 _recordGCEndTime, _countCollection, _cause); 615 } 616