1 /* 2 * Copyright (c) 2003, 2015, 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/parallel/mutableSpace.hpp" 29 #include "gc/serial/defNewGeneration.hpp" 30 #include "gc/serial/tenuredGeneration.hpp" 31 #include "gc/shared/collectorPolicy.hpp" 32 #include "gc/shared/genCollectedHeap.hpp" 33 #include "gc/shared/generation.hpp" 34 #include "gc/shared/generationSpec.hpp" 35 #include "memory/heap.hpp" 36 #include "memory/memRegion.hpp" 37 #include "oops/oop.inline.hpp" 38 #include "runtime/globals.hpp" 39 #include "runtime/javaCalls.hpp" 40 #include "services/classLoadingService.hpp" 41 #include "services/lowMemoryDetector.hpp" 42 #include "services/management.hpp" 43 #include "services/memoryManager.hpp" 44 #include "services/memoryPool.hpp" 45 #include "services/memoryService.hpp" 46 #include "utilities/growableArray.hpp" 47 #include "utilities/macros.hpp" 48 #if INCLUDE_ALL_GCS 49 #include "gc/cms/concurrentMarkSweepGeneration.hpp" 50 #include "gc/cms/parNewGeneration.hpp" 51 #include "gc/g1/g1CollectedHeap.inline.hpp" 52 #include "gc/parallel/parallelScavengeHeap.hpp" 53 #include "gc/parallel/psOldGen.hpp" 54 #include "gc/parallel/psYoungGen.hpp" 55 #include "services/g1MemoryPool.hpp" 56 #include "services/psMemoryPool.hpp" 57 #endif // INCLUDE_ALL_GCS 58 59 GrowableArray<MemoryPool*>* MemoryService::_pools_list = 60 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryPool*>(init_pools_list_size, true); 61 GrowableArray<MemoryManager*>* MemoryService::_managers_list = 62 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryManager*>(init_managers_list_size, true); 63 64 GCMemoryManager* MemoryService::_minor_gc_manager = NULL; 65 GCMemoryManager* MemoryService::_major_gc_manager = NULL; 66 MemoryManager* MemoryService::_code_cache_manager = NULL; 67 GrowableArray<MemoryPool*>* MemoryService::_code_heap_pools = 68 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryPool*>(init_code_heap_pools_size, true); 69 MemoryPool* MemoryService::_metaspace_pool = NULL; 70 MemoryPool* MemoryService::_compressed_class_pool = NULL; 71 72 class GcThreadCountClosure: public ThreadClosure { 73 private: 74 int _count; 75 public: 76 GcThreadCountClosure() : _count(0) {}; 77 void do_thread(Thread* thread); 78 int count() { return _count; } 79 }; 80 81 void GcThreadCountClosure::do_thread(Thread* thread) { 82 _count++; 83 } 84 85 void MemoryService::set_universe_heap(CollectedHeap* heap) { 86 CollectedHeap::Name kind = heap->kind(); 87 switch (kind) { 88 case CollectedHeap::GenCollectedHeap : { 89 add_gen_collected_heap_info(GenCollectedHeap::heap()); 90 break; 91 } 92 #if INCLUDE_ALL_GCS 93 case CollectedHeap::ParallelScavengeHeap : { 94 add_parallel_scavenge_heap_info(ParallelScavengeHeap::heap()); 95 break; 96 } 97 case CollectedHeap::G1CollectedHeap : { 98 add_g1_heap_info(G1CollectedHeap::heap()); 99 break; 100 } 101 #endif // INCLUDE_ALL_GCS 102 default: { 103 guarantee(false, "Unrecognized kind of heap"); 104 } 105 } 106 107 // set the GC thread count 108 GcThreadCountClosure gctcc; 109 heap->gc_threads_do(&gctcc); 110 int count = gctcc.count(); 111 if (count > 0) { 112 _minor_gc_manager->set_num_gc_threads(count); 113 _major_gc_manager->set_num_gc_threads(count); 114 } 115 116 // All memory pools and memory managers are initialized. 117 // 118 _minor_gc_manager->initialize_gc_stat_info(); 119 _major_gc_manager->initialize_gc_stat_info(); 120 } 121 122 // Add memory pools for GenCollectedHeap 123 // This function currently only supports two generations collected heap. 124 // The collector for GenCollectedHeap will have two memory managers. 125 void MemoryService::add_gen_collected_heap_info(GenCollectedHeap* heap) { 126 CollectorPolicy* policy = heap->collector_policy(); 127 128 assert(policy->is_generation_policy(), "Only support two generations"); 129 GenCollectorPolicy* gen_policy = policy->as_generation_policy(); 130 guarantee(gen_policy->number_of_generations() == 2, "Only support two-generation heap"); 131 if (gen_policy != NULL) { 132 Generation::Name kind = gen_policy->young_gen_spec()->name(); 133 switch (kind) { 134 case Generation::DefNew: 135 _minor_gc_manager = MemoryManager::get_copy_memory_manager(); 136 break; 137 #if INCLUDE_ALL_GCS 138 case Generation::ParNew: 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->young_gen(), _major_gc_manager, _minor_gc_manager); 162 add_generation_memory_pool(heap->old_gen(), _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 guarantee(gen != NULL, "No generation for memory pool"); 246 Generation::Name kind = gen->kind(); 247 int index = _pools_list->length(); 248 249 switch (kind) { 250 case Generation::DefNew: { 251 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); 252 DefNewGeneration* young_gen = (DefNewGeneration*) gen; 253 // Add a memory pool for each space and young gen doesn't 254 // support low memory detection as it is expected to get filled up. 255 MemoryPool* eden = add_space(young_gen->eden(), 256 "Eden Space", 257 true, /* is_heap */ 258 young_gen->max_eden_size(), 259 false /* support_usage_threshold */); 260 MemoryPool* survivor = add_survivor_spaces(young_gen, 261 "Survivor Space", 262 true, /* is_heap */ 263 young_gen->max_survivor_size(), 264 false /* support_usage_threshold */); 265 break; 266 } 267 268 #if INCLUDE_ALL_GCS 269 case Generation::ParNew: 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 { 302 assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); 303 ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*) gen; 304 MemoryPool* pool = add_cms_space(cms->cmsSpace(), 305 "CMS Old Gen", 306 true, /* is_heap */ 307 cms->reserved().byte_size(), 308 true /* support_usage_threshold */); 309 break; 310 } 311 #endif // INCLUDE_ALL_GCS 312 313 default: 314 assert(false, "should not reach here"); 315 // no memory pool added for others 316 break; 317 } 318 319 assert(major_mgr != NULL, "Should have at least one manager"); 320 // Link managers and the memory pools together 321 for (int i = index; i < _pools_list->length(); i++) { 322 MemoryPool* pool = _pools_list->at(i); 323 major_mgr->add_pool(pool); 324 if (minor_mgr != NULL) { 325 minor_mgr->add_pool(pool); 326 } 327 } 328 } 329 330 331 #if INCLUDE_ALL_GCS 332 void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) { 333 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); 334 335 // Add a memory pool for each space and young gen doesn't 336 // support low memory detection as it is expected to get filled up. 337 EdenMutableSpacePool* eden = new EdenMutableSpacePool(gen, 338 gen->eden_space(), 339 "PS Eden Space", 340 MemoryPool::Heap, 341 false /* support_usage_threshold */); 342 343 SurvivorMutableSpacePool* survivor = new SurvivorMutableSpacePool(gen, 344 "PS Survivor Space", 345 MemoryPool::Heap, 346 false /* support_usage_threshold */); 347 348 major_mgr->add_pool(eden); 349 major_mgr->add_pool(survivor); 350 minor_mgr->add_pool(eden); 351 minor_mgr->add_pool(survivor); 352 _pools_list->append(eden); 353 _pools_list->append(survivor); 354 } 355 356 void MemoryService::add_psOld_memory_pool(PSOldGen* gen, MemoryManager* mgr) { 357 PSGenerationPool* old_gen = new PSGenerationPool(gen, 358 "PS Old Gen", 359 MemoryPool::Heap, 360 true /* support_usage_threshold */); 361 mgr->add_pool(old_gen); 362 _pools_list->append(old_gen); 363 } 364 365 void MemoryService::add_g1YoungGen_memory_pool(G1CollectedHeap* g1h, 366 MemoryManager* major_mgr, 367 MemoryManager* minor_mgr) { 368 assert(major_mgr != NULL && minor_mgr != NULL, "should have two managers"); 369 370 G1EdenPool* eden = new G1EdenPool(g1h); 371 G1SurvivorPool* survivor = new G1SurvivorPool(g1h); 372 373 major_mgr->add_pool(eden); 374 major_mgr->add_pool(survivor); 375 minor_mgr->add_pool(eden); 376 minor_mgr->add_pool(survivor); 377 _pools_list->append(eden); 378 _pools_list->append(survivor); 379 } 380 381 void MemoryService::add_g1OldGen_memory_pool(G1CollectedHeap* g1h, 382 MemoryManager* mgr) { 383 assert(mgr != NULL, "should have one manager"); 384 385 G1OldGenPool* old_gen = new G1OldGenPool(g1h); 386 mgr->add_pool(old_gen); 387 _pools_list->append(old_gen); 388 } 389 #endif // INCLUDE_ALL_GCS 390 391 void MemoryService::add_code_heap_memory_pool(CodeHeap* heap, const char* name) { 392 // Create new memory pool for this heap 393 MemoryPool* code_heap_pool = new CodeHeapPool(heap, name, true /* support_usage_threshold */); 394 395 // Append to lists 396 _code_heap_pools->append(code_heap_pool); 397 _pools_list->append(code_heap_pool); 398 399 if (_code_cache_manager == NULL) { 400 // Create CodeCache memory manager 401 _code_cache_manager = MemoryManager::get_code_cache_memory_manager(); 402 _managers_list->append(_code_cache_manager); 403 } 404 405 _code_cache_manager->add_pool(code_heap_pool); 406 } 407 408 void MemoryService::add_metaspace_memory_pools() { 409 MemoryManager* mgr = MemoryManager::get_metaspace_memory_manager(); 410 411 _metaspace_pool = new MetaspacePool(); 412 mgr->add_pool(_metaspace_pool); 413 _pools_list->append(_metaspace_pool); 414 415 if (UseCompressedClassPointers) { 416 _compressed_class_pool = new CompressedKlassSpacePool(); 417 mgr->add_pool(_compressed_class_pool); 418 _pools_list->append(_compressed_class_pool); 419 } 420 421 _managers_list->append(mgr); 422 } 423 424 MemoryManager* MemoryService::get_memory_manager(instanceHandle mh) { 425 for (int i = 0; i < _managers_list->length(); i++) { 426 MemoryManager* mgr = _managers_list->at(i); 427 if (mgr->is_manager(mh)) { 428 return mgr; 429 } 430 } 431 return NULL; 432 } 433 434 MemoryPool* MemoryService::get_memory_pool(instanceHandle ph) { 435 for (int i = 0; i < _pools_list->length(); i++) { 436 MemoryPool* pool = _pools_list->at(i); 437 if (pool->is_pool(ph)) { 438 return pool; 439 } 440 } 441 return NULL; 442 } 443 444 void MemoryService::track_memory_usage() { 445 // Track the peak memory usage 446 for (int i = 0; i < _pools_list->length(); i++) { 447 MemoryPool* pool = _pools_list->at(i); 448 pool->record_peak_memory_usage(); 449 } 450 451 // Detect low memory 452 LowMemoryDetector::detect_low_memory(); 453 } 454 455 void MemoryService::track_memory_pool_usage(MemoryPool* pool) { 456 // Track the peak memory usage 457 pool->record_peak_memory_usage(); 458 459 // Detect low memory 460 if (LowMemoryDetector::is_enabled(pool)) { 461 LowMemoryDetector::detect_low_memory(pool); 462 } 463 } 464 465 void MemoryService::gc_begin(bool fullGC, bool recordGCBeginTime, 466 bool recordAccumulatedGCTime, 467 bool recordPreGCUsage, bool recordPeakUsage) { 468 469 GCMemoryManager* mgr; 470 if (fullGC) { 471 mgr = _major_gc_manager; 472 } else { 473 mgr = _minor_gc_manager; 474 } 475 assert(mgr->is_gc_memory_manager(), "Sanity check"); 476 mgr->gc_begin(recordGCBeginTime, recordPreGCUsage, recordAccumulatedGCTime); 477 478 // Track the peak memory usage when GC begins 479 if (recordPeakUsage) { 480 for (int i = 0; i < _pools_list->length(); i++) { 481 MemoryPool* pool = _pools_list->at(i); 482 pool->record_peak_memory_usage(); 483 } 484 } 485 } 486 487 void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage, 488 bool recordAccumulatedGCTime, 489 bool recordGCEndTime, bool countCollection, 490 GCCause::Cause cause) { 491 492 GCMemoryManager* mgr; 493 if (fullGC) { 494 mgr = (GCMemoryManager*) _major_gc_manager; 495 } else { 496 mgr = (GCMemoryManager*) _minor_gc_manager; 497 } 498 assert(mgr->is_gc_memory_manager(), "Sanity check"); 499 500 // register the GC end statistics and memory usage 501 mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, 502 countCollection, cause); 503 } 504 505 void MemoryService::oops_do(OopClosure* f) { 506 int i; 507 508 for (i = 0; i < _pools_list->length(); i++) { 509 MemoryPool* pool = _pools_list->at(i); 510 pool->oops_do(f); 511 } 512 for (i = 0; i < _managers_list->length(); i++) { 513 MemoryManager* mgr = _managers_list->at(i); 514 mgr->oops_do(f); 515 } 516 } 517 518 bool MemoryService::set_verbose(bool verbose) { 519 MutexLocker m(Management_lock); 520 // verbose will be set to the previous value 521 bool succeed = CommandLineFlags::boolAtPut((char*)"PrintGC", &verbose, Flag::MANAGEMENT); 522 assert(succeed, "Setting PrintGC flag fails"); 523 ClassLoadingService::reset_trace_class_unloading(); 524 525 return verbose; 526 } 527 528 Handle MemoryService::create_MemoryUsage_obj(MemoryUsage usage, TRAPS) { 529 Klass* k = Management::java_lang_management_MemoryUsage_klass(CHECK_NH); 530 instanceKlassHandle ik(THREAD, k); 531 532 instanceHandle obj = ik->allocate_instance_handle(CHECK_NH); 533 534 JavaValue result(T_VOID); 535 JavaCallArguments args(10); 536 args.push_oop(obj); // receiver 537 args.push_long(usage.init_size_as_jlong()); // Argument 1 538 args.push_long(usage.used_as_jlong()); // Argument 2 539 args.push_long(usage.committed_as_jlong()); // Argument 3 540 args.push_long(usage.max_size_as_jlong()); // Argument 4 541 542 JavaCalls::call_special(&result, 543 ik, 544 vmSymbols::object_initializer_name(), 545 vmSymbols::long_long_long_long_void_signature(), 546 &args, 547 CHECK_NH); 548 return obj; 549 } 550 // 551 // GC manager type depends on the type of Generation. Depending on the space 552 // availablity and vm options the gc uses major gc manager or minor gc 553 // manager or both. The type of gc manager depends on the generation kind. 554 // For DefNew and ParNew generation doing scavenge gc uses minor gc manager (so 555 // _fullGC is set to false ) and for other generation kinds doing 556 // mark-sweep-compact uses major gc manager (so _fullGC is set to true). 557 TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause) { 558 switch (kind) { 559 case Generation::DefNew: 560 #if INCLUDE_ALL_GCS 561 case Generation::ParNew: 562 #endif // INCLUDE_ALL_GCS 563 _fullGC=false; 564 break; 565 case Generation::MarkSweepCompact: 566 #if INCLUDE_ALL_GCS 567 case Generation::ConcurrentMarkSweep: 568 #endif // INCLUDE_ALL_GCS 569 _fullGC=true; 570 break; 571 default: 572 assert(false, "Unrecognized gc generation kind."); 573 } 574 // this has to be called in a stop the world pause and represent 575 // an entire gc pause, start to finish: 576 initialize(_fullGC, cause,true, true, true, true, true, true, true); 577 } 578 TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC, 579 GCCause::Cause cause, 580 bool recordGCBeginTime, 581 bool recordPreGCUsage, 582 bool recordPeakUsage, 583 bool recordPostGCUsage, 584 bool recordAccumulatedGCTime, 585 bool recordGCEndTime, 586 bool countCollection) { 587 initialize(fullGC, cause, recordGCBeginTime, recordPreGCUsage, recordPeakUsage, 588 recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, 589 countCollection); 590 } 591 592 // for a subclass to create then initialize an instance before invoking 593 // the MemoryService 594 void TraceMemoryManagerStats::initialize(bool fullGC, 595 GCCause::Cause cause, 596 bool recordGCBeginTime, 597 bool recordPreGCUsage, 598 bool recordPeakUsage, 599 bool recordPostGCUsage, 600 bool recordAccumulatedGCTime, 601 bool recordGCEndTime, 602 bool countCollection) { 603 _fullGC = fullGC; 604 _recordGCBeginTime = recordGCBeginTime; 605 _recordPreGCUsage = recordPreGCUsage; 606 _recordPeakUsage = recordPeakUsage; 607 _recordPostGCUsage = recordPostGCUsage; 608 _recordAccumulatedGCTime = recordAccumulatedGCTime; 609 _recordGCEndTime = recordGCEndTime; 610 _countCollection = countCollection; 611 _cause = cause; 612 613 MemoryService::gc_begin(_fullGC, _recordGCBeginTime, _recordAccumulatedGCTime, 614 _recordPreGCUsage, _recordPeakUsage); 615 } 616 617 TraceMemoryManagerStats::~TraceMemoryManagerStats() { 618 MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime, 619 _recordGCEndTime, _countCollection, _cause); 620 }