428 // GC's is still controlled by UseAdaptiveSizePolicyWithSystemGC.
429 if (GCCause::is_user_requested_gc(gc_cause) ||
430 GCCause::is_serviceability_requested_gc(gc_cause)) {
431 return;
432 }
433 // eden_limit is the upper limit on the size of eden based on
434 // the maximum size of the young generation and the sizes
435 // of the survivor space.
436 // The question being asked is whether the gc costs are high
437 // and the space being recovered by a collection is low.
438 // free_in_young_gen is the free space in the young generation
439 // after a collection and promo_live is the free space in the old
440 // generation after a collection.
441 //
442 // Use the minimum of the current value of the live in the
443 // young gen or the average of the live in the young gen.
444 // If the current value drops quickly, that should be taken
445 // into account (i.e., don't trigger if the amount of free
446 // space has suddenly jumped up). If the current is much
447 // higher than the average, use the average since it represents
448 // the longer term behavor.
449 const size_t live_in_eden =
450 MIN2(eden_live, (size_t) avg_eden_live()->average());
451 const size_t free_in_eden = max_eden_size > live_in_eden ?
452 max_eden_size - live_in_eden : 0;
453 const size_t free_in_old_gen = (size_t)(max_old_gen_size - avg_old_live()->average());
454 const size_t total_free_limit = free_in_old_gen + free_in_eden;
455 const size_t total_mem = max_old_gen_size + max_eden_size;
456 const double mem_free_limit = total_mem * (GCHeapFreeLimit/100.0);
457 const double mem_free_old_limit = max_old_gen_size * (GCHeapFreeLimit/100.0);
458 const double mem_free_eden_limit = max_eden_size * (GCHeapFreeLimit/100.0);
459 const double gc_cost_limit = GCTimeLimit/100.0;
460 size_t promo_limit = (size_t)(max_old_gen_size - avg_old_live()->average());
461 // But don't force a promo size below the current promo size. Otherwise,
462 // the promo size will shrink for no good reason.
463 promo_limit = MAX2(promo_limit, _promo_size);
464
465
466 if (PrintAdaptiveSizePolicy && (Verbose ||
467 (free_in_old_gen < (size_t) mem_free_old_limit &&
468 free_in_eden < (size_t) mem_free_eden_limit))) {
|
428 // GC's is still controlled by UseAdaptiveSizePolicyWithSystemGC.
429 if (GCCause::is_user_requested_gc(gc_cause) ||
430 GCCause::is_serviceability_requested_gc(gc_cause)) {
431 return;
432 }
433 // eden_limit is the upper limit on the size of eden based on
434 // the maximum size of the young generation and the sizes
435 // of the survivor space.
436 // The question being asked is whether the gc costs are high
437 // and the space being recovered by a collection is low.
438 // free_in_young_gen is the free space in the young generation
439 // after a collection and promo_live is the free space in the old
440 // generation after a collection.
441 //
442 // Use the minimum of the current value of the live in the
443 // young gen or the average of the live in the young gen.
444 // If the current value drops quickly, that should be taken
445 // into account (i.e., don't trigger if the amount of free
446 // space has suddenly jumped up). If the current is much
447 // higher than the average, use the average since it represents
448 // the longer term behavior.
449 const size_t live_in_eden =
450 MIN2(eden_live, (size_t) avg_eden_live()->average());
451 const size_t free_in_eden = max_eden_size > live_in_eden ?
452 max_eden_size - live_in_eden : 0;
453 const size_t free_in_old_gen = (size_t)(max_old_gen_size - avg_old_live()->average());
454 const size_t total_free_limit = free_in_old_gen + free_in_eden;
455 const size_t total_mem = max_old_gen_size + max_eden_size;
456 const double mem_free_limit = total_mem * (GCHeapFreeLimit/100.0);
457 const double mem_free_old_limit = max_old_gen_size * (GCHeapFreeLimit/100.0);
458 const double mem_free_eden_limit = max_eden_size * (GCHeapFreeLimit/100.0);
459 const double gc_cost_limit = GCTimeLimit/100.0;
460 size_t promo_limit = (size_t)(max_old_gen_size - avg_old_live()->average());
461 // But don't force a promo size below the current promo size. Otherwise,
462 // the promo size will shrink for no good reason.
463 promo_limit = MAX2(promo_limit, _promo_size);
464
465
466 if (PrintAdaptiveSizePolicy && (Verbose ||
467 (free_in_old_gen < (size_t) mem_free_old_limit &&
468 free_in_eden < (size_t) mem_free_eden_limit))) {
|